[AccessD] OpenRecordSet question

Stuart McLachlan stuart at lexacorp.com.pg
Fri Aug 7 17:44:29 CDT 2009


In 16 years of continuously developing complex Access applications, I've never had the 
need to pass a recordset or a field between functions - but thanks for the tip. I'll bear it in 
mind if I ever do come across the need.

(Guess it's because I don't use classes much <g>)

-- 
Stuart




On 7 Aug 2009 at 18:33, jwcolby wrote:

> Unfortunately that doesn't always work.  If RS loses scope the value of RS "goes away".  Inside of 
> the same function this will always work, but if you try to pass the recordset off to another 
> function, or a field off to another function, then things fail to work as you expect.
> 
> I had enough run-ins with this that I decided just to bite the bullet and do the dim db statement as 
> a matter of habit.
> 
> John W. Colby
> www.ColbyConsulting.com
> 
> 
> Stuart McLachlan wrote:
> > As a matter of style, I never bother to Dim db.
> > 
> > I just use:
> > Dim rs as DAO.Recordset
> > Set rs = Currentdb.OpenRecordset("myQuery")
> > 
> > 
> 
> -- 
> 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