Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenRecordSet on CurrentDb

Status
Not open for further replies.

plarsen

Programmer
Jul 30, 2002
27
DK
Hi all

Why can't I use the 'Dim dbs as Database' in Access 2002 (XP)?

How do I use OpenRecordSet in Access 2002?

I have tried 'Set rst = currentDb.OpenRecordSet("SELECT * FROM tblTable")', but it says 'Type Mismatch'

Thanks in advance!

Kind regards

Peter Larsen
 
Hi

Because you need to set a reference to the DAO library

Open any module in desgin view, choose tools \ refernces from the menu, select the Microsoft DAO library

For good measure quailify you dim statements so:

Dim Db as DAO.Database
Dim rs as DAO.Recordset
...etc

to avoid confusion with ADO objects

Reason:

In Access97, DAO was default object library for data access, fron Access2000 on, ADO is the default library for data access, and if you want to use DAO (which you are), then you need to specificly load the library.

The other alternative is to learn and use ADO commands


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top