[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


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

Posted on 2004-10-26
Medium Priority
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

    Call Shell(stAppName, 1)

    Exit Sub

    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.
Question by:Tim Deaton
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 11

Expert Comment

ID: 12412613
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:").

Author Comment

by:Tim Deaton
ID: 12412707
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.
LVL 11

Accepted Solution

Jokra_the_Barbarian earned 500 total points
ID: 12412859
The Universal Naming Convention is what the mapped drive letter is mapped to. Here's some more info:

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.


Author Comment

by:Tim Deaton
ID: 12412973
It worked!  Thanks.
LVL 11

Expert Comment

ID: 12413192
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

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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…

650 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