set con = application.currentproject.connection

J

Joe H.

I have a database application in Access 2002 that works
fine, but when I convert it to Access 97, it gives me a
compile error on set con =
application.currentproject.connection. Is this not
available in Access97?? If not, anyone have a suggestion
how to code around it?
 
A

Alex Dybenko

you can use the following connection string:
"Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=" &
CurrentDb.Name & ""
 
D

Dirk Goldgar

Joe H. said:
I have a database application in Access 2002 that works
fine, but when I convert it to Access 97, it gives me a
compile error on set con =
application.currentproject.connection. Is this not
available in Access97?? If not, anyone have a suggestion
how to code around it?

Right; it's not available in Access 97. In Access 2000 and later, you
can work with the current database either using ADO objects (the
default, but not always the best) or DAO. In Access 97, you use DAO
objects only for this purpose. So instead of the ADO Connection object,
you use a DAO Database object and say something like

Dim db As Database
Dim rs As Recordset

Set db = CurrentDb
Set rs = db.OpenRecordset( ... )

Note that the DAO Recordset object is somewhat different from the ADO
version of the object; check out its properties and methods in the
online help.
 

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