CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 1999
    Location
    VA, USA
    Posts
    8

    Retrieve Application Path

    Hi Gentle folks,

    In MSAccess from the menu items I have set the "default directory" as C:\my documents. My database application is in C:\project. In my application I have to write data to a text file which has to be stored in C:\project. "curdir" returns C:\my documents. Is there any other function or method that can be used to retrieve the path of the database application.

    Thanx in advance .... Nandini


  2. #2
    Join Date
    Oct 1999
    Location
    CA
    Posts
    91

    Re: Retrieve Application Path

    I had a very similar problem a while back. Without going back into my code, I beleive I ended up using CurrentDB.Name


    Brewguru99

  3. #3
    Join Date
    Dec 1999
    Location
    Delhi, India
    Posts
    7

    Re: Retrieve Application Path

    u can use app.path function


  4. #4
    Join Date
    Dec 1999
    Location
    VA, USA
    Posts
    8

    Re: Retrieve Application Path

    The project is in MS Access. VB supports app.path, while VBA doesn't support app.path. Any further help on this would be appreciated.

    Thanks
    Nandini


  5. #5
    Join Date
    Dec 1999
    Location
    Delhi, India
    Posts
    7

    Re: Retrieve Application Path

    you can use CurDir() function

    if you want teh return value as variant type then use this function as it is but if you want to return the value as string type then use $ sign with it
    like CurDir$()


    This example uses the CurDir function to return the current path.

    ' In Microsoft Windows:
    ' Assume current path on C drive is "C:\WINDOWS\SYSTEM".
    ' Assume current path on D drive is "D:\EXCEL".
    ' Assume C is the current drive.
    Dim MyPath
    MyPath = CurDir ' Returns "C:\WINDOWS\SYSTEM".
    MyPath = CurDir("C") ' Returns "C:\WINDOWS\SYSTEM".
    MyPath = CurDir("D") ' Returns "D:\EXCEL".

    ' on the Macintosh:
    ' Drive letters are ignored. Path for current drive is returned.
    ' Assume current path on HD Drive is "HD:MY FOLDER".
    ' Assume HD is the current drive. Drive MD also exists on the machine.
    Dim MyPath
    MyPath = CurDir ' Returns "HD:MY FOLDER".
    MyPath = CurDir("HD") ' Returns "HD:MY FOLDER".
    MyPath = CurDir("MD") ' Returns "HD:MY FOLDER".





    you can check MS Access help for this.


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured