Solved

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

Posted on 2004-10-26
294 Views
Last Modified: 2008-03-06
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.
0
Question by:TimDeaton
    5 Comments
     
    LVL 11

    Expert Comment

    by:Jokra_the_Barbarian
    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:").
    0
     

    Author Comment

    by:TimDeaton
    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.
    0
     
    LVL 11

    Accepted Solution

    by:
    The Universal Naming Convention is what the mapped drive letter is mapped to. Here's some more info:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wnet/wnet/universal_name_info_str.asp

    1. In Windows Explorer, choose "Tools/Map Network Drive" from the menu.
    2. Choose Drive "F".
    3. Copy what's in displayed in the Folder: combo box.
    4. Replace "F:\FOXPROW\NEWFOX25\EXECUTE\PRODNIPR.EXE " with what you copied.

     
    0
     

    Author Comment

    by:TimDeaton
    It worked!  Thanks.
    0
     
    LVL 11

    Expert Comment

    by:Jokra_the_Barbarian
    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
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
    This isn't a frequent question on EE. I must have seen it three or four times (among several thousand questions). However, I use this trick quite often, most frequently as a delayed Current event. A form does not expose it's calculation dependenc…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

    934 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now