Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Low System Resources

Status
Not open for further replies.

illini

Technical User
Aug 2, 2002
89
0
0
FR
I have a form which loops through a recordset, opens an Excel template, moves the data, and then saves the Excel file. As this process occurs, I can see my system resources slowly drain until I receive an system warning that my resources are dangerously low.

I've gone back through the vba code to make sure I had all my objects released after use. Everything appeared fine. Additionally, I took the process step by step to ensure the resources were being released. Everything appeared fine.

So, I re-ran the code and again, my system resources were rapidly being drained.

Here's what's interesting. When I break into the code (using Ctrl + Break) and automatically go to the vb editor, my system resources jump back to where they were prior to running the code. In fact, I can resume the code and let it run until the resources drop dangerously low again.

Does anyone have an idea what is occuring here and how to prevent the loss of resources as this code processes?



-illini
 
Hi,

How much data (no. rows) is being transferred?
Also what operating system does your pc run? Have you tried it on another pc - maybe with a different operating system?

John
 
John,

The number of rows varies.
I'm running Windows 98SE. Most of the other computers around have the same OS. I haven't tried it on another because I'm trying to work out the bugs before installing it on someone else's computer.

Thanks for the feedback.


-illini
 
A couple suggestions:

a. When you say you released your objects after using them, do you mean you set them equal to Nothing? For example if you use the code:
[tt]
Private Sub ...
Dim db as Database
Dim rs as Recordset

Set db = CurrentDB
Set rs = dbOpenRecordset(...)
[/tt]
you should follow (at the end of the Sub) with
[tt]
Set rs = Nothing
Set db = Nothing
End Sub
[/tt]
and you MUST be certain you actually execute those two ending Sets. Therefore if you use an Exit Sub somewhere in ths middle of the subroutine, you must first set those objects = Nothing, then exit the sub.

b. Go to the Visual Basic editor and close all open code windows. Exit the editor and save (can compact & repair if you choose).



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top