Upgrade from Access 97 to 2002

A

Andy May

Hi There

I have been trying to do some codeing in Access 2002 today, I'm having
trouble using DOA to connect to the database. When I use the script:

Dim db as Database
Dim rs as Recordset
Dim sSql as string

set db = currentdb

sSql = "Select * from table"

set rs = db.openrecordset(ssql)


I get a type mismatch error reporting on the openrecordset command. This
used to work fine, what's the new syntax for 2002, can anyone help.

thanks

Andy May
 
W

Wayne Morgan

Access 97 uses DAO by default, Access 2000 & 2002 use ADO by default. You need to set the
reference to DAO. To do this, in the code window go to Tools|References and select
Microsoft DAO 3.6 Object Library.

Now for the next problem, the references are used in the order listed in the References
window. When you check DAO and click Ok, DAO will go to the bottom of the checked list. To
quickly check things, you can use the Up/Down arrows to move DAO above ADO. To fix things
properly, you need to change your DIM statements to remove the ambiguity.

Example:
Dim rs As DAO.Recordset

You can use the Edit|Replace function to change this everywhere in your code fairly
easily. You will need to do this for every object type that exists in both ADO and DAO.
 

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