[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Run a FoxPro2.6 .exe from a button on an Access97 form

Posted on 2004-11-21
Medium Priority
Last Modified: 2008-02-01
A few weeks ago, I asked the question:
about how to run an .exe (created by FoxPro 2.6) from a button on an Access form.

In response to that question, I'm now using the following code to run these programs:
    Call Shell(stAppName, 1)

However, with the program in this example (ITMOVTOM.EXE), it immediately fails with the message: "File 'w:\foxprow\invout\bookeep.dbf' does not exist."  The .dbf file is actually on the "F" drive (alias: "\\NTSERVER\FOXPRO")(like the .exe file), not on the "W" drive (alias: "\\NTSERVER\WORKSHET").  However, the Access .mdb file is on the "W" drive.

The .exe file runs fine from a WinXP icon.

Is there anything I can do to make the .exe run from Access without getting confused?

(I asked this question in the Access forum originally, but no one there ever commented on it.)

Question by:Tim Deaton
  • 2
LVL 33

Accepted Solution

CarlWarner earned 1000 total points
ID: 12640610
Check out your target and starting directories/folders in that WinXP icon.

Also, FoxPro uses a configuration file (config.fpw for FoxPro for Windows and config.fp for FoxPro for DOS, by default) where you can type in the newer DEFAULT data directory for the app/exe to run against.

In that config file, you can add the new line:


or whatever it really is.

Then, you'll have to force the FoxPro calling string to point to that config file so it will run it.  If your FoxPro programmer is using the main config file and you will break his setup in changing it, you can actually use another name for your config file to differentiate from the Fox default one.  Use config.fpa or Tim.fp or whatever.  It's just a simple text file and the trick is to tell your string to call it.

Call Shell(stAppName, 1)

In this case, Tim.fp will have to physically exist somewhere in the path, OR you can type in a full valid path before the filename AFTER the -c switch.

LVL 33

Expert Comment

ID: 12640689
I looked at that older question asked in the Access topic area.

Do not assume that UNC conventions work under that older FoxPro version.  That version of FoxPro, really released as FoxPro 2.5, was released in 1993.  It wasn't really designed or written with UNC in mind at that time.  In fact, it wasn't even written by Microsoft which bought out Fox software in late 1992.  It was written for Windows 3.1 and is now an old 16-bit app in the Windows version (32-bit in the FoxPro for DOS extended memory version).   If you want to try and use it to set your default data directory, plan on the UNC stuff failing.  You will more than likely have to use a call to a mapped drive.  Just a word of warning so you don't waste a lot of time wondering what UNC fails.

Author Comment

by:Tim Deaton
ID: 12767950
Sorry to take so long to get back to this.  My main responsibility is bookkeeping, and the Access tinkering takes place as breaks in the workload allow.

I tried working with the config file, but with no success.  I found a CONFIG.FPW file in the executable's directory and copied it to ACINVOUT.FPW, adding your "DEFAULT=" line and not changing anything else.  The result is copied below:

I still got the same error as before.  Eventually, I thought back to the days when I worked with dos batch files, and found a "ChDrive" command in Access.  I modified the code as follows, and it works:

    ChDrive "F"
    Call Shell(stAppName, 1)
    ChDrive "W"

Thanks for your help, tho.  

By the way: I don't understand what you're refering to in the paragraph about "UNC conventions".  I assume the "UNC" probably stands for Universal Naming Conventions", but I don't know anything about them.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Suggested Courses

872 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