Link to home
Start Free TrialLog in
Avatar of Tim Deaton
Tim DeatonFlag for United States of America

asked on

Acc97: Use button on a form to run a FoxPro .exe

I'm using a form with buttons as a menu in Access97.  I want to create a button on that menu that runs an .exe file created by our FoxPro programmer.  If I run the .exe from a WindowsXP shortcut icon, it runs fine.  But when I try it from my Access button, it starts running, then fails with the message "invalid path or filename".

Here's the code:
Private Sub exeCreateCustInvenDBF_Click()
On Error GoTo Err_exeCreateCustInvenDBF_Click

    Dim stAppName As String

    stAppName = "F:\FOXPROW\NEWFOX25\EXECUTE\PRODNIPR.EXE -t"
    Call Shell(stAppName, 1)

Exit_exeCreateCustInvenDBF_Click:
    Exit Sub

Err_exeCreateCustInvenDBF_Click:
    MsgBox Err.Description
    Resume Exit_exeCreateCustInvenDBF_Click
   
End Sub


I'm assuming that the difference is that when I create a Windows shortcut there is a "Start In" blank for entering the path to the files used by the program you're running.  But I don't know how to do the same thing in Access.

Thanks for your help.
Avatar of Jokra_the_Barbarian
Jokra_the_Barbarian
Flag of United States of America image

Where does the database reside, on a workstation or a file server? Try replacing the path with a UNC path. That way, you don't have to rely upon a mapped drive ("F:").
Avatar of Tim Deaton

ASKER

1. I don't know what a "UNC path" is.
2. Everything resides on the file server.  The part of it where my Access files live is mapped as the "W" drive, and the part where the Foxpro files live is mapped as the "F" drive.
ASKER CERTIFIED SOLUTION
Avatar of Jokra_the_Barbarian
Jokra_the_Barbarian
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It worked!  Thanks.
You're welcome. Always use a UNC whenever possible since you can't guarantee that every workstation or server has the same mapped drives. -Jokra