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

Access 2K CurrentProject.Connection equivalent for Access 97 1

Status
Not open for further replies.

RickBerem

Programmer
Jan 18, 2001
156
CA
Hi,

I've been reading quite a few posts now but wasn't able to find the answer I was looking for. I want to find the Access 97 equivalent for Access 2K's

Code:
CurrentProject.Connection

I need that to access the current database with ADO from Access 97.
Code:
Dim cnn As ADODB.Connection

Set cnn = CurrentProject.Connection

Thanks for any help,
SG
 
This may not be the best way (but it works!). When I use ADO in 97 I create a connection string that points to the db.

eg.

Public gcnnDB As New ADODB.Connection

cnnDB.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=Z:\Sample Access DB\Test.mdb;" & _
"Uid=admin;" & _
"Pwd="

I make a the cnnDB global and a public function to connect so you don't have to keep typing it in.

There are two ways to write error-free programs; only the third one works.
 
Thanks GHolden,

I thought of that but I was hopping there would be an option like
Code:
CurrentDB
to be certain that I dont' need to hard code the database path.

I guess I'll just use this option!

Thanks again SG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top