VBA - CurrentDB() path ??

M

MVP - WannaB

Is there a command that can be used to retrieve the path of the current DB?
I found that Application.CurrentProject.Path can be used with msgbox to
display the current path, but I am looking to be able to set the value of a
const in a modules declarations so that it can be used throughout the
module?
Thank you, I appreciate your help.
 
D

Douglas J. Steele

Not sure I understand your question. You can't "set the value of a const in
a modules declaration" using a command or function. Constants have to be
declared as constants...

Application.CurrentProject.Path can be used anywhere you want the path:
there's no magic that makes it only work with MsgBox.

Is this contrary to what you're finding?
 
J

JvC

Use CurrentDB.Name, and strip off the file name.

Left(CurrentDB.Name, InstrRev(currentdb.name))

John

MVP - WannaB explained on 9/12/2008 :
 
M

MVP - WannaB

Thank you all, very much
I was able to get my module to work by setting only the db names as
constants in the declarations section. I then used
Application.CurrentProject.Path in each module and concatenated the 2
together. I am not sure why I was previously unable to get
Application.CurrentProject.Path to work on anything but msgbox, (I may have
been using SET, and I am still not clear on when that should be used).
Thanks again.
 
Top