Charlotte Foust
cfoust at infostatsystems.com
Tue Nov 16 11:01:14 CST 2004
John, I believe the recordset generated in passing as you did it, goes out of scope with the database object it was created on. You haven't instantiated the recordset object, so it has no separate existence. Charlotte Foust -----Original Message----- From: Colby, John [mailto:JColby at dispec.com] Sent: Tuesday, November 16, 2004 6:59 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] What happens to the recordset? I learned a long time ago that you could retrieve a value from a single record recordset using syntax like: strInvAlt = db.OpenRecordset(strSQL)!TopExpense where you don't dim a recordset, you just opened the recordset using db.openrecordset() and then referenced a field of the recordset with the !SomeField syntax. My question is, the recordset itself is never assigned to a dimmed recordset object. Furthermore there is no db.CloseRecordset() syntax. Does the recordset just stay open until the database object itself is closed or is used to open a different recordset? I have a situation where I would dim a database object in the form header and set that database object in OnOpen (to save the time it takes to Set DB), then use this syntax to retrieve a value in OnCurrent. I don't want the recordset hanging out there though. In thinking this through it seems that if the db is not dimmed / set each time in the OnCurrent then I should NOT use this syntax, but rather dim / set a recordset object as well in the form header / OnOpen and then set the recordset object in the OnCurrent, grab the field value and explicitly close the recordset (but NOT set the recordset object = nothing) Did that make any sense? Thoughts on the subject? John W. Colby The DIS Database Guy -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com