Running Visual Integrator Job From Within Access

SOLVED

I am trying to run a Visual Integrator job when you click a button on an form in Microsoft Access. The job wont run, and I believe it has something to do with the fact that the Access application is open. I have tested the same command string that I am using in the VBA module in a desktop shortcut. The shortcut works, and the data from Access is imported into Sage, but only if the Access application is not open. I think this is much like Visual Integrator not being able to import a CSV file while it is open. There must be a way to handle this as it seems like a very basic thing to want to do.

I am running Sage 100 Premium (SQL) and Access 2013.

Does anyone have a suggestion?

Thanks!

Parents
  • 0

    What does the command string in the desktop shortcut look like? And how are you trying to launch it from VBA?

  • 0 in reply to jimatqsi

    The string used for the desktop short cut is as follows:

    "S:\Sage\Sage 100 Premium ERP\MAS90\Home\pvxwin32.exe" ..\LAUNCHER\SOTAPGM.INI ..\SOA\STARTUP.M4P -ARG DIRECT UION USER PASSWORD XXX VIWI0G AUTO

    The VBA in Access is as follows:

    Private Sub BtnPostToSage_Click()

    Dim RetVal

    RetVal = """S:\Sage\Sage 100 Premium ERP\MAS90\Home\pvxwin32.exe"" ..\LAUNCHER\SOTAPGM.INI ..\SOA\STARTUP.M4P -ARG DIRECT UION USER PASSWORD XXX VIWI0G AUTO"

    End Sub

    I could be totally off on the VBA code. It's my best guess from searching the net.

    Thanks for any help you can offer!

  • 0 in reply to gseales

    Still getting "error 53 file not found"

    My VB code:

    strBatch = "C:\Store Deposits\DepositsImport.bat"

    Shell strBatch

    Contents of batch file:

    C:

    CD "S:\Sage\Sage 100 Premium ERP\MAS90\Home"

    pvxwin32.exe..\LAUNCHER\SOTAPGM.INI ..\SOA\STARTUP.M4P -ARG DIRECT UION USER PASSWORD XXX VIWI0G AUTO

    I even messed with Access' Trusted Locations in case that has anything to do with it....not that I really know what I am doing in there. I added the path to the bat file, and the path to pvxwin.

    Thanks!

  • 0 in reply to MEI154

    It is necessary to discover whether the problem is in the batch file or in the shell out to the batch file. Add this line to the beginning of your batch file

    PAUSE

    That will make the batch file display a "Press any key to continue" message.

    You can also go to the command line (Start button and type CMD in the run box then change to the folder where your batch file is) and run the batch file directly from the command line just to verify the batch file is correct.

    Jim

  • 0 in reply to MEI154

    Maybe you need to use the full path for ..\SOA and ..\LAUNCHER.  

    I don't know the difference between the values I used in my example and what you have, for the pvxwin32.exe, but could try what I have.  However, I am running mine from the workstation path and not from the server.  It looks to me the your "Sage 100 Premium ERP" is a directory from the install on the server.  Whereas "Sage 100 ERP Workstation", like my example, is actually for the path installed on a workstation.  Just throwing out ideas.

  • 0 in reply to jimatqsi

    Thank you for the suggestion. It did cause me to learn something. In order to create a batch file, you have to save it with quotes around the file name. Mine was just a text file with a bat extension. Now I have a real batch file. Clicking the button control in Access now does cause the command window to pop up because of PAUSE, but that is about it; it does not go on to run any of the Sage stuff after "pressing any key".

    Batch file code:

    PAUSE

    C:

    CD "S:\Sage\Sage 100 Premium ERP\MAS90\Home"

    pvxwin32.exe..\LAUNCHER\SOTAPGM.INI ..\SOA\STARTUP.M4P -ARG DIRECT UION USER PASSWORD XXX VIWI0G AUTO

    Sometimes the shortcut works when the Access application is open, sometimes it wont work until the Access application is closed

    Shortcut string: "S:\Sage\Sage 100 Premium ERP\MAS90\Home\pvxwin32.exe" ..\LAUNCHER\SOTAPGM.INI ..\SOA\STARTUP.M4P -ARG DIRECT UION USER PASSWORD XXX VIWI0G AUTO

    Suggestions for next steps?

    .

  • 0 in reply to gseales

    I tried your example of targeting the workstation and am getting "Access to Application "IMPWEB" is denied"

    What exactly is IMPWEB?

  • 0 in reply to MEI154
    verified answer

    I forgot about that one, it is the "App Name". Below is what I had received from Sage about how to do this and it list what each of the values are.  The "IMPWEB" is the name of an application that is setup on the Application Server Configuration.

    110-405391 - How to create a shortcut to run a V/I import job, export job, or other Sage MAS 90 and 200 task outside the program.

    Entry Type: Informational

    Product:

    Sage MAS 90 ERP

    Sage MAS 200 ERP

    Sage MAS 200 ERP - SQL Server Edition

    Sage MAS 90 Extended Enterprise Suite

    Application: Visual Integrator

    Version Reported: ALL

    Subject:

    How to create a shortcut to run a V/I import job, export job, or other Sage MAS 90 and 200 task outside the program.

    Possible Resolution:

    Sage MAS 200 only, 4.40.0.4 and higher

    The MAS 200 Application Server must be used to run the VI jobs (or other such tasks) externally from a workstation client using a batch (.bat) file so that the ODBC path to the MAS 200 server is not modified, thus causing MAS 200 to fail to launch certain tasks.

    All users must exit and the Application Server or Service must be stopped

    Add the Job to Menu by clicking the ‘Menu’ button in ‘Import Job Maintenance’ for the Job and follow the Wizard.

    Select Programs / Sage Software / Application Server Configuration.

    Click the Apps tab > click the New button.  The screen New - App Props for Server: "SAGE" will open

    Enter a name for the application under App Name (for this example “Import”)

    Note: The 'App Name' will be referenced in the batch file to execute the VI Job or similar task.

    Enter the following values

    ProvideX EXE: leave <Default> Server INI: Enter ..\Launcher\Sota.ini

    Lead Program: Enter StartUp.M4P

    Leave the Extra CMD Options and Arguments fields blank Start-In Directory: Enter the path to the ..\MAS90\Home folder from the MAS 200 server's perspective. (Ex.  C:\Sage Software\MAS 200\Version4\MAS90\Home)

    Init Window: Select Hidden

    In the Options section, ‘only Allow Client Arguments’ must be checked, the rest of the options must be unchecked.

    Click ‘Ok’ to close the New - App Props for Server: "SAGE" screen

    Press Apply button to save the new Application Name settings in Application Server Configuration.

    Warning:  If there are users in the system they must exit, Applying the settings will disconnect all sessions.

    The following format must be used to run the VI Job or External task from the workstation, using the Application Server Application.

    C:\<MAS 200 Workstations Path>\Home\Pvxwin32.exe -hd ..\launcher\sota.ini *Client -ARG "Server" "Port" "App Name" -ARG= DIRECT UION User Password CompanyCode JobName DISPLAY Batch file example:

    Example: "C:\Sage Software\MAS 200 Client\Version4\MAS90\Home\Pvxwin32.exe" -hd ..\launcher\sota.ini *Client -ARG "ACCTSERVER" "10000" "IMPORT" -ARG= DIRECT UION JohnDoe MyPass ABC VIWI00 DISPLAY

    Note: When creating a Windows shortcut the "Start  In" directory is the client "Home" directory

    Example: "C:\Sage Software\MAS 200 Client\Version4\MAS90\Home"

    Note: When creating a batch file or script the command line must be preceeded by a change directory to Home.

    Example: CD "C:\Sage Software\MAS 200 Client\Version4\MAS90\Home"

  • 0 in reply to gseales

    This information is very helpful.  I got everything set up, and the batch file is executed when I click the button in my Access application, but the data still is not imported. If I manually run the batch file by double clicking it, the data will import, but only if the Access application is closed. I know the batch is executing through Access because I put PAUSE as the last line in the file, so it opens the command window, and it shows no errors.

    It seems that there is something about the VI ODBC connection that wont allow it to read the Access database when Access is open. I figure it may be much like not being able to import a CSV file if it is open. There must a way to work around this. It seems like a very basic thing to want to do. The only thing I can think of is to have the Access application produce a text file that the VI job could then import.

    The Sage documentation celebrates VI as being built to interact through ODBC, so there has to be a way to make this work directly with the Access tables without the application needing to be closed.

    Has anyone else had this problem?

  • 0 in reply to MEI154

    Try splitting the Access database so the data is one Access db and the forms in another. The program using the ODBC connection to move the data will not have to concern itself with Access front-end. Probably shelling out to DOS/Windows has put that in a temporarily unresponsive state, waiting for the shell call to terminate. Separate program from data and I bet it works.

  • 0 in reply to gseales

    It works!

    I got the idea to run the VI job from the jobs menu to see if it would complete the import while the Access application was open, and it did. Ever since then, clicking the button in the Access application successfully runs the import when the application is open. I don't know why, but it does.

    Thanks to everyone for sticking with me until I got this working. I sincerely appreciate all your help!

  • 0 in reply to gseales

    How do I create the APP NAME?

Reply Children