[AccessD] ADODB.recordset Scope Question

Stuart McLachlan stuart at lexacorp.com.pg
Thu Feb 19 17:40:25 CST 2009


Yep
"Set rs = rsUsers_Master"
makes rs another reference to the same recordset.
Close rs and you close  rsUsers_Master

If you want to work with a separate copy of the data use
Set rs = rsUsers_Master.Clone

-- 
Stuart


On 20 Feb 2009 at 9:06, Borge Hansen wrote:

> 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
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com





More information about the AccessD mailing list