[AccessD] ADODB.recordset Scope Question

Borge Hansen pcs.accessd at gmail.com
Thu Feb 19 17:06:40 CST 2009


Hi All,
Quick question:
The application on opening of a particular Form (that stays open and hidden
until the application is closed or User logs in under another User Name)
opens a few ADODB recordsets.
On the closing of the Form the recordsets are closed and set to nothing...

Example:
On opening of the Form, a recordset is created called rsUsers_MASTER


I am using the recordset as part of the Application's security.
In a  separate Function called many times throughout the application
session, I do something like

dim rs as new ADODB.recordset
set rs = rsUsers_Master

'Do something with the rs
'.. and then

rs.close
set rs = nothing

...
However, that appears to make rsUsers_MASTER close and go out of scope....
I run the sub once - it works fine - the next time I see that after
rs = rsUsers_MASTER
rs is nothing



So can you people confirm that when I
set rs = rsUsers_MASTER
I am really working with rsUsers_MASTER and not a separate copy of it held
in rs ???

And when it comes to tidying up the rs, I don't need to do the usually
rs.close
set rs = nothing

??

I really would like to be able to work with a *separate* copy of
rsUsers_MASTER that I can close and set  to nothing at the end of the
procedure.

How do I do that??

Regards to all... it's been a while since I last dropped in to AccessD ....,
Borge



More information about the AccessD mailing list