• Current directory of database (A2K SR1)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Current directory of database (A2K SR1)

    Author
    Topic
    #374746

    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?
    ( 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.

    Viewing 2 reply threads
    Author
    Replies
    • #607196

      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

      • #607572

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

    • #607207

      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.

    • #607478


      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.

      • #607501

        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.

        • #607573

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

    Viewing 2 reply threads
    Reply To: Current directory of database (A2K SR1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: