dao syntax - Help!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In the following code I get a "can't find program or library" error on this
statement Dim db As DAO.Database . Am I missing a library that doesn't come
with access? Please help. Thanks.



Private Sub db_betw_dates_obj_MouseDown(Button As Integer, Shift As Integer,
X As Single, Y As Single)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String

Set db = OpenDatabase("roncheck1.mdb")
strSQL = "select * " _
& "where DATE Between " _
& "#[start_date_cal.value]# And #[end_date_cal.value]#;"
Set rs = db.OpenRecordset(strSQL)
End Sub
 
Sounds as if you haven't set a reference to DAO in your database. It's not a
default library in ACCESS 2000 and 2002.

Open Visual Basic Editor, click on Tools | References, and find Microsoft
Data Access Objects library. Check its checkbox. That should do it.
 
With any module open, select Tools | References from the menu bar. Scroll
through the list of available references until you find Microsoft DAO 3.6
Object Library. Select it and close the dialog.
 
Thanks that helped but now I get the same error in the

Set db = OpenDatabase("roncheck1.mdb")

for OpenDatabase. Which library am I missing now? Thanks again.

Douglas J. Steele said:
With any module open, select Tools | References from the menu bar. Scroll
through the list of available references until you find Microsoft DAO 3.6
Object Library. Select it and close the dialog.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


******** said:
In the following code I get a "can't find program or library" error on this
statement Dim db As DAO.Database . Am I missing a library that doesn't come
with access? Please help. Thanks.



Private Sub db_betw_dates_obj_MouseDown(Button As Integer, Shift As Integer,
X As Single, Y As Single)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String

Set db = OpenDatabase("roncheck1.mdb")
strSQL = "select * " _
& "where DATE Between " _
& "#[start_date_cal.value]# And #[end_date_cal.value]#;"
Set rs = db.OpenRecordset(strSQL)
End Sub
 
That's a DAO statement, so the DAO Object Library's all you should need.

When you went into the References dialog, were any marked as "MISSING:"? If
so, try deleting them, then going to the Debug menu and compile your entire
application. If you needed any of the missing references, errors will be
highlighted.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


******** said:
Thanks that helped but now I get the same error in the

Set db = OpenDatabase("roncheck1.mdb")

for OpenDatabase. Which library am I missing now? Thanks again.

Douglas J. Steele said:
With any module open, select Tools | References from the menu bar. Scroll
through the list of available references until you find Microsoft DAO 3.6
Object Library. Select it and close the dialog.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


******** said:
In the following code I get a "can't find program or library" error on this
statement Dim db As DAO.Database . Am I missing a library that doesn't come
with access? Please help. Thanks.



Private Sub db_betw_dates_obj_MouseDown(Button As Integer, Shift As Integer,
X As Single, Y As Single)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String

Set db = OpenDatabase("roncheck1.mdb")
strSQL = "select * " _
& "where DATE Between " _
& "#[start_date_cal.value]# And #[end_date_cal.value]#;"
Set rs = db.OpenRecordset(strSQL)
End Sub
 
Back
Top