vba trouble... 
Author Message
 vba trouble...

Have the below in some VBA code but it won't recognize the
names.  I'm using Access 2002 now did something change?

Doesn't understand the below arguments.
Dim db As database
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)

thx



Tue, 02 Aug 2005 01:32:06 GMT  
 vba trouble...
First, ensure you have your DAO references set.

From a module: Tools->References.  Uncheck ADO references,
add DAO (3.x) reference.

Second, ensure you set your db variable.  For example:

dim rs as recordset
set rs = currentdb.openrecordset("qry")
...

or
dim db as database
dim rs as recordset

set db = currentdb
set rs = db.openrecordset("qry")
...

Quote:
>-----Original Message-----
>Have the below in some vba code but it won't recognize
the
>names.  I'm using Access 2002 now did something change?

>Doesn't understand the below arguments.
>Dim db As database
>Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)

>thx
>.



Tue, 02 Aug 2005 01:41:39 GMT  
 vba trouble...
I Added the DAO 3.6 and it resolves the issue with the
Database.. Thanks.

The Recordset is still not working.  It is coming up with
a type mismatch error.  Here is the code.
Dim db As Database
Dim rs As Recordset
Dim strSQL As String

DatabaseName = UCase(DatabaseName)
Dim myDate As Date: myDate = Now()
strSQL = "SELECT * FROM TBLLOGOUT WHERE APPLICATIONNAME
= '" & DatabaseName & "' AND INACTIVE = 0 AND #" & myDate
& "# BETWEEN LOGOFFSTART AND LOGOFFEND"
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)

Quote:
>-----Original Message-----
>First, ensure you have your DAO references set.

>From a module: Tools->References.  Uncheck ADO
references,
>add DAO (3.x) reference.

>Second, ensure you set your db variable.  For example:

>dim rs as recordset
>set rs = currentdb.openrecordset("qry")
>....

>or
>dim db as database
>dim rs as recordset

>set db = currentdb
>set rs = db.openrecordset("qry")
>....

>>-----Original Message-----
>>Have the below in some vba code but it won't recognize
>the
>>names.  I'm using Access 2002 now did something change?

>>Doesn't understand the below arguments.
>>Dim db As database
>>Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)

>>thx
>>.

>.



Tue, 02 Aug 2005 02:01:34 GMT  
 vba trouble...
Did you remove your ADO references?

Both ADO and DAO have a recordset object.  It may be
confused.

Dim rs as DAO.Recordset

would explicitly differentiate between the ADO and DAO rs.

... holla back



Tue, 02 Aug 2005 02:36:24 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. VBA trouble shooting

2. VBA trouble shooting

3. Launching Word from VB - VBA troubles

4. Ms Project VBA Troubles

5. Newbie having trouble with VBA Code in Access

6. Trouble with text boxes in VBA for Word.

7. trouble adding to table in vba

8. trouble adding to table in vba

9. trouble adding to table in vba

10. Trouble faxing report in access VBA on window XP and 2003

11. Trouble going from VBA to VB

12. Need Help: Trouble adding a custom menu pick to a custom popup menu in VBA

 

 
Powered by phpBB® Forum Software