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!

Set a global prameter for location of DB

Status
Not open for further replies.

RogueVW

Programmer
Oct 8, 2002
15
US
I have a database that split into a Front and Back ends, the back ends are replicated. The DB is used on several computers. Each computer uses a different user name thanks to the way XP file system is used, but the location of the dB is the same after each user. i.e.

C:\Documents and Settings\Jons\My Documents\Database\DBName.mdb

C:\Documents and Settings\Bills\My Documents\Database\ReplicaDBName.mdb

There is extensive use of VB in the Modules of the Front End.

Is there a way to set the location of the database globally so that you could update just one line of code for each DB with out having to update each occurance of the location of the DB.

 
Hi RogueVW,

Paste this into the Declarations Section of a Module:

Global gAccessPath As String

This in the On Click event of a Button to return the Path Only:

gAccessPath = Application.CurrentProject.Path
MsgBox gAccessPath

Or you could use this to return the Full Path and DB Name:

gAccessPath = CurrentDb.Name
MsgBox gAccessPath

Regards

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top