Results 1 to 7 of 7
  1. #1
    bginhb is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    Huntington Beach, CA, USA
    Posts
    47

    Unexpected Results from Curdir?

    My application is being launched from:

    C:\Users\Bill\Dropbox\DesktopLaptop\MDalia

    but when I use a Curdir or Curdir$ function in a Private Sub embedded in a button click event and stopped by a breakpoint after the Curdir function has been run and executed - the VBA Immediate window shows:



    ?curdir$
    C:\Users\Bill\Documents

    Do I need to do something special to set the current directory equal to the accdb launch directory?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You would need to do a ChDir but why bother? Is it causing you problems?

  3. #3
    bginhb is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    Huntington Beach, CA, USA
    Posts
    47

    Where to put my help files

    Yes, it is.

    When I distribute the DB I wanted to allow the Users to install it anywhere. That in itself is not a problem as the DB is completely self contained but I have also needed to provide 2 PDFs as help files and thought the best way was to instruct the Users to save them in the same directory as the accdb.

    So if I am unable to determine the directory of the DB I have to have them save them in a common location and that appears to be My Documents as that seems to be the default current directory default location regardless of OS.

    Not ideal, in my opinion!

  4. #4
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    So if I am unable to determine the directory of the DB ...<snip>
    Curdir (or Curdir$) is a DOS environmental variable. To get the directory the dB is in, use "CurrentProject.Path"

    Code:
    Dim MyPath as string
    MyPath = CurrentProject.Path
    Msgbox MyPath

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    That's why Access has CurrentProject.Path.

  6. #6
    bginhb is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    Huntington Beach, CA, USA
    Posts
    47
    Thank you all for your assistance!
    That resolves my problem ... I will designate the thread "solved".

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Glad we could help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 05-14-2012, 07:24 AM
  2. Iff with multiple results?
    By monkeyman in forum Queries
    Replies: 1
    Last Post: 05-19-2011, 02:27 PM
  3. InStrRev returning unexpected results
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 12-07-2010, 01:04 PM
  4. Query showing unexpected results
    By johnmerlino in forum Queries
    Replies: 30
    Last Post: 10-25-2010, 07:08 AM
  5. Need help grouping results.
    By cljac in forum Queries
    Replies: 9
    Last Post: 03-24-2010, 10:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums