Results 1 to 5 of 5

Thread: get path

  1. #1
    Join Date
    Apr 2004
    Location
    Bucharest, Romania
    Posts
    16

    Question Unanswered: get path

    Hi,

    I have an Access db that should create a new file. To know where to create this new db I need to know the path (without file name) of the first one.
    Anyone can help me?

    Thanks,
    dny

  2. #2
    Join Date
    Dec 2002
    Posts
    60
    DatabasePath = Left$(CurrentDb.Name, InStr(CurrentDb.Name, Dir(CurrentDb.Name)) - 1)

  3. #3
    Join Date
    Mar 2003
    Location
    Bogota
    Posts
    67
    Use this to get the path with filename:

    dim sPath as string
    dim sDir as string
    dim iPos as integer
    sPath = Application.CurrentDb.Name
    iPos = instrrev(sPath,"\")
    sDir = left(sPath, iPos)

    If you don't want the backslash to be included in the final result, use iPos - 1 in the last line.

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Here's another way just in case you weren't confused yet:

    Application.CurrentProject.Path

  5. #5
    Join Date
    Apr 2004
    Location
    Bucharest, Romania
    Posts
    16
    It works fine. Thanks a lot.

    dny

Posting Permissions

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