Results 1 to 4 of 4
  1. #1
    Join Date
    May 2007
    Posts
    27

    Unanswered: How to find the directory of the .mdb (using vba)

    Hi,

    How do I find the directory (using vba) where my access database (the .mdb file) is located?

    Thanks!

  2. #2
    Join Date
    Jan 2008
    Location
    Denver, CO
    Posts
    54
    Found your answer on this site. It says:

    To get the directory path of the currently open database in Access 2-97, retrieve the Name property of the database in VBA. Here's the simple code to do it:
    Code:
    Function GetDbPath() As String
        Dim MyDb as Database
        
        Set MyDb = CurrentDB()
        GetDbPath = MyDb.Name
    End Function
    In Access 2000 or 2002 (Xp), use the CurrentProject.Name and CurrentProject.Path properties to get the same information.

  3. #3
    Join Date
    May 2007
    Posts
    27
    Thank you very much!

  4. #4
    Join Date
    Jan 2008
    Location
    Denver, CO
    Posts
    54
    My pleasure! Glad I could help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •