VBA - CurrentDB() path ??

  • Thread starter Thread starter MVP - WannaB
  • Start date Start date
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.
 
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?
 
Use CurrentDB.Name, and strip off the file name.

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

John

MVP - WannaB explained on 9/12/2008 :
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top