[AccessD] OpenRecordSet question

Max Wanadoo max.wanadoo at gmail.com
Fri Aug 7 17:43:20 CDT 2009


IMO one should always dim the DB object.

I believe that the methods are *slightly* different when used directly from
CurrentDB. As opposed to from the dimensioned db.

As an example:
If you do a currentdb.execute("Delete * xyz) you will not get an error
message

But you will if it has been dimmed.

Am I right?  Might be a bit confused..getting late and on my second
half-pint of the week.

Max


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: 07 August 2009 23:13
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] OpenRecordSet question

As a matter of style, I never bother to Dim db.

I just use:
Dim rs as DAO.Recordset
Set rs = Currentdb.OpenRecordset("myQuery")


On 7 Aug 2009 at 16:17, Heenan, Lambert wrote:

> Looks a touch like Air Code there.  Should be....
> 
> Dim db As dao.Database
> Dim rs As dao.Recordset
> 
>     Set db = CurrentDb
>     Set rs = db.OpenRecordset("MyQuery") 
> 
> Lambert
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby
> Sent: Friday, August 07, 2009 4:10 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] OpenRecordSet question
> 
> In dao you can definitely just open the query (or table)
> 
> Dim db as dao.database
> dim rst as dao.recordset
> 
> 	set db = currentdb
> 	set rst = db.Open("MyQuery")
> 
> John W. Colby
> www.ColbyConsulting.com
> 
> 
> Charlotte Foust wrote:
> > If you're doing this in code, you have to use Select * from myquery.  
> > As a datasource, you can use the named query.
> > 
> > Charlotte Foust
> > 
> > -----Original Message-----
> > From: accessd-bounces at databaseadvisors.com
> > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur 
> > Fuller
> > Sent: Friday, August 07, 2009 12:49 PM
> > To: Access Developers discussion and problem solving
> > Subject: [AccessD] OpenRecordSet question
> > 
> > Can I open a recordset just using a named query, or do I have to 
> > select
> > * from myquery? I can't remember.
> > TIA,
> > Arthur
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> > 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com


-- 
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