Microsoft Access 2007: Displaying the Current Database Path

When I sit down to consult with someone on an existing database, one of the first things I want to know is, “where in the file system does this live?”  Most end-users have no idea.  They launch the database from the list of recently used databases that is displayed on the Access 2007 startup screen.  That list is handy, and much improved from previous versions, in that it gives you the database name and, if you hover the link, the full path.  There’s no way to copy the path so you can paste it into the address bar of a Windows Explorer window, but at least you can find it.

But why not put the path on a form in the database itself?  It can fit nicely into the footer or on an “about this database” form, if you have one.  And it’s easy as can be, here are the steps:

  1. Choose a form, enter Design View, and insert a new Text Box control (from the Controlls group of the Design tab on the Ribbon)
  2. Right-click the control and choose Properties from the context menu
  3. Click the All tab of the Property Sheet pane
  4. Change Name to txtLocation
  5. Change Control Source to =[currentProject].[fullname]
  6. Change Locked to Yes
  7. Exit Design View and test your form

You’ll have to adjust the width of the text box to accommodate long paths.  I ended up reducing the font size and deleting the label entirely so that I could get it all in the footer of a form.  I think I’m going to add this field to all the databases that I regularly work on.  It’s incredibly handy to be able to see the path at a glance, especially when you’re working on more than one at a time, and it might (I hope) help end-users understand where their files live.

If you’re troubleshooting an existing database, and want to quickly determine the path, you can do so by pressing Alt+F11, to launch the VBA editor, typing ?currentproject.FullName into the Immediate window, and pressing return.

[Update:]  If you just want the filename, use =[currentProject].[Name]