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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DAO recordset and Excel Memory Leak?

Status
Not open for further replies.

RaKKeR

Programmer
Nov 22, 2004
26
NL
Hi,

I use a DAO recordset to change some values in an excel worksheet. The problem is every time the update method from the recordset is fired the memory usage increases and stays allocated. Is this a known issue? Here is some pseudo-code to show you where the problem is:

<code>
Dim db as DAO.Database
Dim rs as DAO.Recordset
...
Set db = ...
Set rs = db.OpenRecordset("Sheet1$", dbOpenDynaset)
...
While ...
rs.FindFirst "searchstring"
If Not rs.NoMatch Then
rs.Edit
rs!Field = "Data"
rs.Update 'Memory usage increases here!
End If
Wend
...
rs.Close
...
</code>

I hope someone can help me out here,

Thx in advance,

RaKKeR
 
Check out the recordset object's UpdateBatch method - that might help.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
Thx for your reply,

The Update method with the dbUpdateBatch parameter doesn't work with my recordset (maybe because it loaded an excel worksheet). I can only use the default parameter (dbUpdateRegular). It's only increasing the memory usage when some value in the recordset has been changed. Any other suggestions on this one?

Thx in advance,

RaKKeR
 
Try this

Code:
...
rs.Close
set rs = nothing
...

By the way to enclose code use [] not <>
 
I already set the recordset to Nothing at the end. Thats not the problem. The problem is I keep searching in the same recordset in a loop and everytime update is called the memory usage increases...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top