473,395 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Kill a RecrodSet in VBA

NarenMCA
Hi Everyone,

I have a couple of dropdowns, based on the selection by user I must display values from many worksheets. I am using ADODB concept in VBA.

I am using the below code to get data from various sheets in a excel workbook.

Call rstNetAct.Open(strSQL, strConnStr, CursorTypeEnum.adOpenForwardOnly, LockTypeEnum.adLockReadOnly, CommandTypeEnum.adCmdText)

once the Output is shown, I am trying to kill this recordset as this occupies a lot of space in RAM.

I used the below code,

If (rstNetAct.State = ObjectStateEnum.adStateOpen) Then
rstNetAct.Close
End If
Set rstNetAct = Nothing

But it is useless. The RAM usage comes down only if I close the excel application.

(To avoid this I have used Pivot concept also, as I take data from different sheets that are in different formates. So, I must create 22 pivot tables and change selections in all of'em when the user selects a value in the dropdown. I takes lot of time to display the output.)


Is there is any way that I could flush out all the data(Data loaded by the query I used) from the RAM?

Please help.

Thanks in advance,
Naren
Nov 25 '08 #1
4 2017
QVeen72
1,445 Expert 1GB
Hi,

Yes, Your Excel App takes the RAM,
Setting Recordset = Nothing, is enough to clear the RAM taken by recordset object..

Regards
Veena
Nov 25 '08 #2
Hi Veena,

I am setting RecordSet = Nothing every time when the macro runs. If I open the task manager, it shows a huge memory space occupied. So when the user gets on to the next task, It again takes some more space in the RAM. So at a point of time the application stucks.

I guess "Nothing" will just clear the references to the recordset object but the querry o/p(Data) that is temporarily kept in RAM by the recordset is not getting flushed out unless I close Excel application.
Nov 25 '08 #3
Hi There,

Try to Dispose the object.

AdoCon.Dispose

Hope this help you

Rpicilli
Nov 25 '08 #4
Hi Rpicilli,

It throws the below error.
"Method or Data Member not found."

Can you help me with more details that I must include to my code along with "RecSetName.Dispose".

Thanks,
Naren
Nov 26 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Bob Swerdlow | last post by:
My application starts up a number of processes for various purposes using: self.popen = popen2.Popen3("/usr/local/bin/python -O "myscript.py") and then shuts them down when appropriate with...
3
by: Alex Hunsley | last post by:
I'm running a monitoring script under linux written in python. It's nohup'ed so that I can log out and it will continue running happily and so on, but sometimes I need to kill the script before...
10
by: Vilmar Brazão de Oliveira | last post by:
HI people, what is wrong in the code bellow to kill iexplore.exe process after processing my page?? '»»Before comes routines to access data base and to send email. Set objWshell =...
10
by: Fred | last post by:
There is a setting in INIT.ORA that has the unintended side-effect of making sure the ALTER SYSTEM KILL SESSION command has immediate affect. Without this setting, I've seen some instances where...
2
by: Micky | last post by:
Can any one give me some pointers on how to kill a running procedure in DB2? I have a long running procedure called from a Java routine and after I kill the Java routine, the procedure keeps...
1
by: Alexander N. Spitzer | last post by:
I am trying to write a program that will fork a process, and execute the given task... the catch is that if it runs too long, I want to clean it up. this seemed pretty straight forward with a...
3
by: elrondrules | last post by:
Hi Am new to python and need your help!! this is my code snip. within my python script I have the following commands.. <snip> import os
4
by: Richard Rossel | last post by:
Hi Fellows, I have a problem with process termination. I have a python code that apache runs through a django interface. The code is very simple, first, it creates a process with the...
3
by: spectrumdt | last post by:
Hello. I am running Fedora Linux and KDE, using the Konsole command line. When coding Python, I regularly make a bug causing my program to not terminate. But how do I kill the non-terminating...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.