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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert ADO CurrentProject.Connection to Access 97

Status
Not open for further replies.

TomHW

Programmer
Sep 8, 2004
100
US
I am converting a database from Access 2002 back to Access 97 and much of the code is written in ADO. As opposed to having to convert all of the code to DAO I would prefer to just keep the ADO format. In converting I have noticed that Access 97 does not recognize CurrentProject. I have the following references selected:

Microsoft ActiveX Data Objects 2.5 Library
Microsft ADO Ext. 2.5 for DDL and Security
Microsoft DAO 3.6 Object Library
Visual Basic for Applications
Microsoft Access 8.0 Object Library

From reading around I am lead to believe that CurrentProject doesn't exist in Access 97 even though ADO does. Does anyone knows of any other ADO code that accomplishes the same thing in ADO, or any other references that I may be missing to allow CurrentProject to work in Access 97?

A small example of in context would be this example which allows the changing of user passwords:


Dim cat As ADOX.Catalog
Dim usr As ADOX.User

Set cat = New ADOX.Catalog
cat.ActiveConnection = CurrentProject.Connection

Set usr = cat.Users(strUser)

usr.ChangePassword strOld, strNew



Any help would be greatly appreciated.

Thanks,
Tom
 
Check this site for connection string.


I believe the information you are looking for resides in the system.mdw which is available for all the access applications on your pc. I don't think you can set up a connection string to your current app since Access may not allow a 2nd connection to an open app, but if you connect to another app the system.mdw information should be the same. Let me know if this works out for you.
 
CurrentProject is an object that was added in Access 2000 to refer to the database/project from which the VBA code is being run. It didn't exist in Access 97. According to Microsoft, the closest replacement in Access 97 is CurrentDb.

You can find more (similar) information here:

 
In Access 2000 and above the currentproject.connection is the ADO connection string to your current app. You can build your own connection string. In Access 97 the app is a DAO connection.
 
cmmrfrds and dysphoric,

Thanks for the help. I ended up just converting all of the code from ADO to DAO where CurrentProject was used.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top