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

Connection String to Current Database 1

Status
Not open for further replies.

Poduska

Technical User
Dec 3, 2002
108
US
I have been using this connection string which always refers to the database "Sales_Reporting.mdb". However, users have been creating their own copy of the database with a different name but the code always looks to the original MDB file and not the newly named MDB.

How can I make the "Sales_reporting.mdb" part below always just point to the Current database that is open?

Code:
    strConn = "Provider=Microsoft.jet.oledb.4.0;" & _
         "Data Source=" & CurrentProject.Path & _
       "\Sales_Reporting.mdb"
 
This should give you your current ADO connection string:

CurrentProject.Connection

That being said, you probably never really need the connection string because you could always just use the CurrentProject's connection directly, e.g.

rsADO.Open "MyTable", CurrentProject.Connection



 
It's too easy!

It works great.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top