Can't "Dim dbs as database"

  • Thread starter Thread starter Samatha
  • Start date Start date
S

Samatha

My VBA for access 2002 doesn't let me "dim dbs as
database" because "database" is not defined and it's not
on the list. How come? I see microsoft's sample
databasese can. how do i fix this?
 
ACCESS 2000 and 2002 do not have a reference to DAO library set as a default
library. You need to go into Tools | References (from VBE) and select
Microsoft Data Access Objects 3.x library from the list.
 
-----Original Message-----
My VBA for access 2002 doesn't let me "dim dbs as
database" because "database" is not defined and it's not
on the list. How come? I see microsoft's sample
databasese can. how do i fix this?
.
I'm having the same issue so I hope some kind soul
answers this!
 
"mary_jane_steele@hotmail dot com"

The Database object is a DAO object, and Access 2000 and 2002 don't
include a reference the DAO Object Library by default. You must add a
reference to it, if you want to use DAO objects. To do that, open the
VB Editor and click Tools -> References... on its menu bar. In the
References dialog, locate Microsoft DAO 3.6 Object Library in the list,
and put a check mark in the box next to it.

The DAO library and the ADO (ActiveX Data Objects) library that is set
as a default reference in Access 2000+ contain several f the same
objects. Therefore, it's best if you either remove the ADO reference if
you don't plan to use it, or else always identify each object you
declare from these libraries as to which library, DAO or ADODB, that it
comes from. For example,

Dim db As DAO.Database 'not strictly necessary, not in ADO lib
Dim rs1 As DAO.Recordset 'necessary
Dim rs2 As ADODB.Recordset 'a good idea
 
Back
Top