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

Find folder name where a MDB that's running is located`

Status
Not open for further replies.

flowersr

MIS
Feb 11, 2004
43
US
Hi,

Is there a way to find out thru VB code what the folder is that a MDB that is currently running is in? I am trying to access another MDB is the same folder and need to know the path.

Thanks, Rich
 
Hello flowersr,

CurrentDb.Name will return the entire path of your current db. Given the fact you know the name of the current db you could pars out or replace the current db name with blanks and keep the application path.

i.e. (pardon the crudeness here)
Knowing that my current database is called db8.mdb then

Private Sub Command0_Click()
Dim stPath As String
stPath = CurrentDb.Name
stPath = Replace(stPath, "db8.mdb", "")
MsgBox stPath

End Sub

YOu should get a msgbox that has the path including the last backslash and then append your new db name.



Andy Baldwin

"Testing is the most overlooked programming language on the books!
 
flowersr,
[tt]CurrentProject.Path[/tt]?

CMP

(GMT-07:00) Mountain Time (US & Canada)
 
Thats what I originally thought but on my current system it returned nothing. Afterall that is the better answer. Just tried it on my older system (access2k) and it worked.

Andy Baldwin

"Testing is the most overlooked programming language on the books!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top