Default Database Folder

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

I'm progressing on developing my database program and now
am beginning to think about how to make it easily
portable. Basically, I want my VBA code to learn where
the database file is on the user's computer/network/etc.
and store the pathname into a string variable. That way,
I can use that path to store other files that are
generated by the program.

Is there anyway to do this? And if not, is there some way
to dynamically set the Default Database Folder for the
program through simple VBA code? If possible, I'd rather
not have to use registry keys and all that.

Thanks,

Rob
 
Starting with Access 2000 you can use
CurrentProject.Path
to get database file's location and
CurrentProject.Name
to get database fileName
Prior to that you would need to use
CurrentDb.Name
to get full fileName and then extract the path from there.

HTH
 
Assuming Access 2000 or later ...

CurrentProject.Path

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Back
Top