Public as Database

  • Thread starter Thread starter Joe M 2
  • Start date Start date
J

Joe M 2

When working with unbound forms, I use the code "Public DB
As Database" in the General Declarations section of my VBA
Module. This works fine in Access 97 or an Access 2000
database that was converted from Access 97.
But "Database" is not a valid option in a newly created
Access 2000 database. Can anyone tell me how to use this
command without first creating the database in 97 and
converting it to 2000?
 
Access 2000 defaults to using ADO type recordsets, where 97
defaulted to DAO. If you are going to use the same type that
you were used to you now need to specify the DAO
selection...

Dim db as DAO.Database
Dim rs ad DAO.Recordset

or

Public DB As DAO.Database
--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 
Joe,

I suspect that you need to set a reference in your Access 2000 database to
the Microsoft DAO 3.6 Object Library.
 
Check your references, you are probably missing the reference to the DAO
Library. In A2000 this reference is not created by default on new databases.
To fix, open the module in the Visual Basic Editor (VBE) then click
Tools->References. Make sure that the Microsoft DAO 3.x Object Library is
checked. You might also want to check this article details and info on how
to fix the problem:

http://www.mvps.org/access/bugs/bugs0031.htm
 
Thanks - the linked article walked me through what I
needed to know!
-----Original Message-----
Check your references, you are probably missing the reference to the DAO
Library. In A2000 this reference is not created by default on new databases.
To fix, open the module in the Visual Basic Editor (VBE) then click
Tools->References. Make sure that the Microsoft DAO 3.x Object Library is
checked. You might also want to check this article details and info on how
to fix the problem:

http://www.mvps.org/access/bugs/bugs0031.htm

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

When working with unbound forms, I use the code "Public DB
As Database" in the General Declarations section of my VBA
Module. This works fine in Access 97 or an Access 2000
database that was converted from Access 97.
But "Database" is not a valid option in a newly created
Access 2000 database. Can anyone tell me how to use this
command without first creating the database in 97 and
converting it to 2000?

.
 
Back
Top