Reading Tables

  • Thread starter Thread starter Old Music Lover
  • Start date Start date
O

Old Music Lover

I have not programmed in VBA in quite a while. Apparently how you open and
table and read records has changed since I last coded in MSAccess.

How do you do it?

I can't even get a "Dim MyDB as Database" to compile.
 
Dim MyDB As DAO.Database

ACCESS 2000 and 2002 do not have a reference set to DAO library by default.
So, if you're using one of these versions, you'll need to set a reference
manually to the DAO library.

Dim MyDB As DAO.Database
Dim rst As DAO.Recordset
Set MyDB = CurrentDb
Set rst = MyDB.OpenRecordset("TableName", dbOpenDynaset)
' do things
rst.Close
Set rst = Nothing
MyDB.Close
Set MyDB = Nothing
 
"ACCESS 2000 and 2002 do not have a reference set to DAO library by default.
So, if you're using one of these versions, you'll need to set a reference
manually to the DAO library."

How do I do this?
 
From the Visual Basic Editor window, click Tools | References, and scroll
down the list to find Microsoft Data Access Object library v3.x. Select it.
 
Back
Top