set con = application.currentproject.connection

  • Thread starter Thread starter Joe H.
  • Start date Start date
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?
 
you can use the following connection string:
"Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=" &
CurrentDb.Name & ""
 
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.
 
Back
Top