VBA Doesn't recognize DAO.RecordSet 
Author Message
 VBA Doesn't recognize DAO.RecordSet

I created a new database and a new form. I used DAO code in the new form just as I did in another database. For some reason it doesn't work in the new database. The code is:

Private Sub Command0_Click()
Dim rList As dao.Recordset, rQuery As dao.Recordset
Dim dbs As Database
Set dbs = CurrentDb
sql = "select * from [Sample Data]"
Set rList = dbs.OpenRecordset(sql)

sql = "Select * from [Excel Test Query]"
Set rQuery = dbs.OpenRecordset(sql)

rList.MoveFirst
Do Until rstMBC.EOF
    MsgBox rList!table + " " + rList![field name]
    rList.MoveNext
Loop
    MsgBox "Done"
End Sub

I know this code works in the other database. I believe I am overlooking some setup. Could you help?

Thanks,

Elliot



Mon, 07 Mar 2005 01:13:44 GMT  
 VBA Doesn't recognize DAO.RecordSet

Unlike earlier versions, Access 2000 and later don't reference the DAO library.  To change this, from the code window, choose Tools, then References, and in the References dialog that appears, check the box beside the entry for "Microsoft DAO 3.51 Object Library".

  I created a new database and a new form. I used DAO code in the new form just as I did in another database. For some reason it doesn't work in the new database. The code is:

  Private Sub Command0_Click()
  Dim rList As dao.Recordset, rQuery As dao.Recordset
  Dim dbs As Database
  Set dbs = CurrentDb
  sql = "select * from [Sample Data]"
  Set rList = dbs.OpenRecordset(sql)

  sql = "Select * from [Excel Test Query]"
  Set rQuery = dbs.OpenRecordset(sql)

  rList.MoveFirst
  Do Until rstMBC.EOF
      MsgBox rList!table + " " + rList![field name]
      rList.MoveNext
  Loop
      MsgBox "Done"
  End Sub

  I know this code works in the other database. I believe I am overlooking some setup. Could you help?

  Thanks,

  Elliot



Mon, 07 Mar 2005 01:21:16 GMT  
 VBA Doesn't recognize DAO.RecordSet
Except that it's Microsoft DAO 3.6 Object Library for Access 2000 and 2002.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele


Unlike earlier versions, Access 2000 and later don't reference the DAO
library.  To change this, from the code window, choose Tools, then
References, and in the References dialog that appears, check the box beside
the entry for "Microsoft DAO 3.51 Object Library".



I created a new database and a new form. I used DAO code in the new form
just as I did in another database. For some reason it doesn't work in the
new database. The code is:

Private Sub Command0_Click()
Dim rList As dao.Recordset, rQuery As dao.Recordset
Dim dbs As Database
Set dbs = CurrentDb
sql = "select * from [Sample Data]"
Set rList = dbs.OpenRecordset(sql)

sql = "Select * from [Excel Test Query]"
Set rQuery = dbs.OpenRecordset(sql)

rList.MoveFirst
Do Until rstMBC.EOF
    MsgBox rList!table + " " + rList![field name]
    rList.MoveNext
Loop
    MsgBox "Done"
End Sub

I know this code works in the other database. I believe I am overlooking
some setup. Could you help?

Thanks,

Elliot



Mon, 07 Mar 2005 06:12:02 GMT  
 VBA Doesn't recognize DAO.RecordSet
Thanks.  You're right.



Quote:
> Except that it's Microsoft DAO 3.6 Object Library for Access 2000 and
2002.

> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele



> Unlike earlier versions, Access 2000 and later don't reference the DAO
> library.  To change this, from the code window, choose Tools, then
> References, and in the References dialog that appears, check the box
beside
> the entry for "Microsoft DAO 3.51 Object Library".



> I created a new database and a new form. I used DAO code in the new form
> just as I did in another database. For some reason it doesn't work in the
> new database. The code is:

> Private Sub Command0_Click()
> Dim rList As dao.Recordset, rQuery As dao.Recordset
> Dim dbs As Database
> Set dbs = CurrentDb
> sql = "select * from [Sample Data]"
> Set rList = dbs.OpenRecordset(sql)

> sql = "Select * from [Excel Test Query]"
> Set rQuery = dbs.OpenRecordset(sql)

> rList.MoveFirst
> Do Until rstMBC.EOF
>     MsgBox rList!table + " " + rList![field name]
>     rList.MoveNext
> Loop
>     MsgBox "Done"
> End Sub

> I know this code works in the other database. I believe I am overlooking
> some setup. Could you help?

> Thanks,

> Elliot



Mon, 07 Mar 2005 07:41:48 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. HELP : Access 97 doesn't recognize my MDB file

2. Doesn't recognize name or names

3. VB doesn't recognize ODBC stuff.

4. Doesn't recognize stored procedure parameter

5. VBScript doesn't recognize date in Hebrew

6. Setup Wizard doesn't recognize LAN drive on NT 4.0

7. DIR function doesn't recognize file

8. DATE TIME PICKER DOESN'T SEEM TO RECOGNIZE NULL

9. CRW 7 doesn't recognize date fields?

10. Help: Crystal doesn't recognize access 2000 table

11. Still doesn't recognize Access2000 db

12. VB doesn't recognize dim db as Database

 

 
Powered by phpBB® Forum Software