Link to home
Start Free TrialLog in
Avatar of Tim Deaton
Tim DeatonFlag for United States of America

asked on

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

A few weeks ago, I asked the question:
https://www.experts-exchange.com/questions/21183178/Acc97-Use-button-on-a-form-to-run-a-FoxPro-exe.html
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:
    stAppName = "\\NTSERVER\FOXPRO\FOXPROW\NEWFOX25\EXECUTE\ITMOVTOM.EXE -t"
    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.)

ASKER CERTIFIED SOLUTION
Avatar of CarlWarner
CarlWarner
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start 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.
Avatar of Tim Deaton

ASKER

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:
    CATMAN=OFF
    talk=off
    TMPFILES=C:\TEMP
    MVCOUNT=2000
    CONFIRM=ON
    DELETED=ON
    OPTIMIZE=ON
    EXCLUSIVE=OFF
    KEYCOMP=WINDOWS
    CODEPAGE=AUTO
    TIME=2000000
    DOSMEM=OFF
    REM CENTURY=ON
    _FELOGO=OFF
    _FEDEVELOPER=OFF
    #WINOBJ      
    REM COMMAND=DO C:\FEX\EXPRESS.APP
    REM _FEUSER=SONNY
    REM _EXPRESS=E:\FOXPROW\FEX\EXPRESS.APP
    DEFAULT=F:\FOXPROW\INVOUT

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"
    stAppName = "\\NTSERVER\FOXPRO\FOXPROW\NEWFOX25\EXECUTE\ITMOVTOM.EXE -t -cACINVOUT.FPW"
    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.