Dim dbs As Database - type unrecognised

D

Dal

I want to declare dbs as Database but get runtime error 13, type mismatch.

What am I doing wrong?

I can see that 'Database' is a type used in the help files. I remember
using it myself many times a few years ago but it is now not recognised.

I have MS Access 2000 and am a bit rusty having not used it properly for a
few years. I am writing the code in a Sub() in a module.

The project is to copy a list of Word document filenames from a specified
folder on the PC, load the file names into a table. The user can then choose
a number of the files, and print them in a specified order.

Any help appreciated.

Thanks

Dal
 
D

Douglas J Steele

Database is an object in the DAO model. By default, Access 2000 (and 2002,
for that matter) doesn't have a reference set to the DAO library.

While you're in the VB Editor, select Tools | References from the menu bar,
scroll through the list of available references until you find the one for
Microsoft DAO 3.6 Object Library, and select it. If you're not going to be
using ADO, uncheck the reference to Microsoft ActiveX Data Objects 2.1
Library

If you have both references, you'll find that you'll need to "disambiguate"
certain declarations, because objects with the same names exist in the 2
models. For example, to ensure that you get a DAO recordset, you'll need to
use Dim rsCurr as DAO.Recordset (to guarantee an ADO recordset, you'd use
Dim rsCurr As ADODB.Recordset)

The list of objects with the same names in the 2 models is Connection,
Error, Errors, Field, Fields, Parameter, Parameters, Property, Properties
and Recordset
 
B

Burton Rabinowitz

I want to declare dbs as Database but get runtime error 13, type mismatch.

What am I doing wrong?

I can see that 'Database' is a type used in the help files. I remember
using it myself many times a few years ago but it is now not recognised.

I have MS Access 2000 and am a bit rusty having not used it properly for a
few years. I am writing the code in a Sub() in a module.

The project is to copy a list of Word document filenames from a specified
folder on the PC, load the file names into a table. The user can then choose
a number of the files, and print them in a specified order.

Any help appreciated.

Thanks

Dal

what
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top