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

Memory

Status
Not open for further replies.

Tronsliver

Technical User
Sep 19, 2000
120
US
If I create the Function below in a module off of "Form" and call the "Function" mulitiple times, will it create muliple instances of the recordset or will the recordset be destroyed in memory when the code in the Function reaches rst.close after each iteration? Obviously, I'm concerned about memory usage. Thanks!

Public Function FindAuthStr(varx As Integer)
Dim rst As Recordset
Dim x As Double

Set rst = CurrentDb().OpenRecordset("qryAuthAssign", dbOpenDynaset)

With rst

.MoveFirst
Do Until .EOF
If !orgstrPrNbr = varx Then
x = x + !streintAuthStr
End If
.MoveNext
Loop
FindAuthStr = x
rst.Close

End With
End Function

 
The recordset should be destroyed but to play it safe you can:

set rst = nothing

Mike Pastore

Hats off to (Roy) Harper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top