Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Feb 2002
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Current directory of database (A2K SR1)

    How would I get with codes the location (full path of the directory) of a database that is opened by
    (a) using File->Open in Access 2K?
    ([img]/forums/images/smilies/cool.gif[/img] double-clicking the name of the database in Windows Explorer?

    If I open a database in A2K, what does CurDir() return? The current location of MS Access or the location of my database, if the two are located in different places?

    I am confused. Please help.

  2. #2
    Star Lounger
    Join Date
    Nov 2001
    Location
    Illinois, USA
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Current directory of database (A2K SR1)

    Application.CurrentProject.Path will give the full path to your database
    Application.CurrentProject.FullName will give the full path including the filename of the .mdb file
    CurDir() will give the path to the default database folder as set on Tools --> Options --> General within Access

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Current directory of database (A2K SR1)

    You can also use CurrentDb.Name to return the full path and filename of the current mdb, and that will work in earlier versions of Access as well.
    Charlotte

  4. #4
    Lounger
    Join Date
    Apr 2001
    Location
    Khon Kaen, Thailand
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Current directory of database (A2K SR1)

    ...
    If I open a database in A2K, what does CurDir() return? The current location of MS Access or the location of my database, if the two are located in different places?
    ...

    To your last question, CurDir() will return the path of the db.

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Current directory of database (A2K SR1)

    Not necessarily. It depends on how you open the database. If you open it via a shortcut (which I always do, because of workgroups) it just gives your default directory. If you open it from the Open dialog within Access, then it will give the path. Don't use curdir() if you want to reliably get the path to the database.

  6. #6
    2 Star Lounger
    Join Date
    Feb 2002
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Current directory of database (A2K SR1)

    Thanks Dottie. I use Application.CurrentProject.Path to get the path to the database.Thanks too to Tim and Charlotte for helping me.

  7. #7
    2 Star Lounger
    Join Date
    Feb 2002
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Current directory of database (A2K SR1)

    I agree with you Douglas, and reliability or the lack of it in using CurDir() caused me intermittent problem.

Posting Permissions

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