-
Nov 21st, 2002, 03:19 PM
#1
Thread Starter
New Member
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?
-
Nov 21st, 2002, 03:27 PM
#2
that should work...
did you do
VB Code:
Dim vPath as string
vPath = App.Path
MsgBox vPath
or did you try just
did you get an error? or just a blank msgbox when you tried it?
-
Nov 21st, 2002, 03:35 PM
#3
Thread Starter
New Member
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"
-
Nov 21st, 2002, 03:37 PM
#4
Addicted Member
I've entered that exactly in my program and it ran fine.
-
Nov 21st, 2002, 03:38 PM
#5
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.
-
Nov 21st, 2002, 03:40 PM
#6
Addicted Member
I thought that perhpas he could have renamed the button Command0 for some unspecified reason...
-
Nov 21st, 2002, 03:42 PM
#7
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
-
Nov 21st, 2002, 04:02 PM
#8
Thread Starter
New Member
You are correct, I'm using Access. currentproject.Path worked fine. Thanks for your help.
-
Nov 21st, 2002, 07:13 PM
#9
Hyperactive Member
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.
-
Nov 21st, 2002, 08:02 PM
#10
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?
-
Nov 21st, 2002, 08:06 PM
#11
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|