Results 1 to 11 of 11

Thread: App.Path

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2002
    Posts
    15

    App.Path

    Has anyone seen an instance where app.path does not worK? I am just trying to view it by using:

    vPath = App.Path
    MsgBox vPath

    Are there any referrences that should be included?

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    that should work...

    did you do

    VB Code:
    1. Dim vPath as string
    2. vPath = App.Path
    3. MsgBox vPath

    or did you try just

    VB Code:
    1. msgbox App.Path


    did you get an error? or just a blank msgbox when you tried it?

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2002
    Posts
    15
    This is my code exactly as it is in the program.

    Private Sub Command0_Click()

    Dim vPath As String
    vPath = App.Path
    MsgBox vPath

    End Sub

    When the button is clicked I get:

    Run time error '424'
    Object required


    Debug highlights "vPath = App.Path"

  4. #4
    Addicted Member run_GMoney's Avatar
    Join Date
    May 2002
    Location
    Detroit
    Posts
    186
    I've entered that exactly in my program and it ran fine.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    You are not using VB are you? (There is no Command0 button in VB)

    I'm guessing you are probably using Access, or some form of VBA, like Excel or something.

    I don't know if App.Path is supported on these platforms.

    However, I can categoretically tell you that if you were, indeed, using Visual Basic your code would work. I just ran it. It worked fine.

  6. #6
    Addicted Member run_GMoney's Avatar
    Join Date
    May 2002
    Location
    Detroit
    Posts
    186
    I thought that perhpas he could have renamed the button Command0 for some unspecified reason...

  7. #7
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    Originally posted by Hack
    You are not using VB are you? (There is no Command0 button in VB)
    yeah... use

    Code:
    currentproject.Path
    if you are using access 2k or XP... not sure if it is in Access 97

  8. #8

    Thread Starter
    New Member
    Join Date
    Sep 2002
    Posts
    15
    You are correct, I'm using Access. currentproject.Path worked fine. Thanks for your help.

  9. #9
    Hyperactive Member Blinky Bill's Avatar
    Join Date
    Mar 2002
    Location
    Happily munching on the greenery in your garden
    Posts
    349
    You do have to be careful with App.Path though, i've noticed that if you use it on the root of a drive you get "C:\" but if you run in a sub directory you get "C:\myDir". Note the backslash.

    Just something i thought i'd share.
    We don't know what's wrong. . . So the best bet might be to remove something surgically.

  10. #10
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    Originally posted by Blinky Bill
    You do have to be careful with App.Path though, i've noticed that if you use it on the root of a drive you get "C:\" but if you run in a sub directory you get "C:\myDir". Note the backslash.

    Just something i thought i'd share.
    ummm yeah isn't that the whole points of app.path?

  11. #11
    Hyperactive Member Blinky Bill's Avatar
    Join Date
    Mar 2002
    Location
    Happily munching on the greenery in your garden
    Posts
    349
    yes it is, but i've had a few probs in the past with installers where i've tested the code on my system, and it hasn't worked on the cd and it was because i didn't allow for the fact that it was running in a sub dir on my system and a root dir on the cd, so i thought i'd mention that it's not an entirely consistent function. Consistent would be always appending the backslash.
    We don't know what's wrong. . . So the best bet might be to remove something surgically.

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