W
Wembly
Hi,
I was wondering if it is good practice to close recordsets
as and when they are used.
For example, in a sub-procedure, we may have the following:
Set db = currentdb
Set rs1 = db.openrecordset("table", dbOpenDynaset)
rs1.findfirst Criteria1 & " and " & Criteria2
var1 = field1
var2 = field2
var3 = field3
rs1.close
Set rs2 = db.openrecordset("SELECT MAX(field7) FROM table
WHERE [ID] = CurrentID")
var4 = field4
var5 = field5
rs2.close
db.close
Are the two "close" statements necessary for better memory
management, or would the mere fact that when another
recordset has been SET will close the previously opened
recordset, as in, when rs2 (in the above example) is SET,
would rs1 be closed or would I need to explicitly close it
(as in the example)?
Thanks.
Wembly
I was wondering if it is good practice to close recordsets
as and when they are used.
For example, in a sub-procedure, we may have the following:
Set db = currentdb
Set rs1 = db.openrecordset("table", dbOpenDynaset)
rs1.findfirst Criteria1 & " and " & Criteria2
var1 = field1
var2 = field2
var3 = field3
rs1.close
Set rs2 = db.openrecordset("SELECT MAX(field7) FROM table
WHERE [ID] = CurrentID")
var4 = field4
var5 = field5
rs2.close
db.close
Are the two "close" statements necessary for better memory
management, or would the mere fact that when another
recordset has been SET will close the previously opened
recordset, as in, when rs2 (in the above example) is SET,
would rs1 be closed or would I need to explicitly close it
(as in the example)?
Thanks.
Wembly