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

Posted on 2004-11-21
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:TimDeaton
    LVL 33

    Accepted Solution

    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

    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

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Suggested Solutions

    This article describes some very basic things about SQL Server filegroups.
    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    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…

    759 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

    14 Experts available now in Live!

    Get 1:1 Help Now