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

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.)

Tim DeatonFreelance BookkeeperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
Tim DeatonFreelance BookkeeperAuthor Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.