Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need to get Path of current loaded database (Access 2000)

    Does anyone know how I can determine the path of the of the database that I am currently using. We have some users who refuse to take a copy of the current database and use the production version. I want to examine the the location of the database they are using and if they are not on the C drive I want to force the database to close.

    Thank you
    Don
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Need to get Path of current loaded database (Access 2000)

    CurrentDb.Name returns the full path of the database that is currently open. You could check the first letter of this path:

    If Not Left(CurrentDb.Name) = "C" Then
    MsgBox "Database not installed locally.", vbInformation
    Application.Quit
    End If

  3. #3
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Need to get Path of current loaded database (Access 2000)

    <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15> Hans, As usual you have saved the day. <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Don
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Need to get Path of current loaded database (Access 2000)

    FYI, in addition to Hans' solution, another option available starting with Access2000 is the use of the CurrentProject object, so you can use CurrentProject.Path to the get the full path to the directory the currentdb is sitting in, and CurrentProject.Name to get the only the name of the database.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  5. #5
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Need to get Path of current loaded database (Access 2000)

    Thank you Mark
    Don
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

Posting Permissions

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