Upgrade from Access 97 to 2002

  • Thread starter Thread starter Andy May
  • Start date Start date
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
 
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.
 
Back
Top