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!

  • 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 MEI154

    I have done it plenty of times in Access. Most of the time I just Shelled it out.

  • 0 in reply to BigLouie

    Can you elaborate on how to "shell it out"?

  • 0 in reply to MEI154

    Try:

    Private Sub BtnPostToSage_Click()

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

  • 0 in reply to BigLouie

    What you suggest throws a "run time error '53' file does not exist". If I try ("""S:\Sage\Sage 100.....that's three quotation marks at the lead, I get "error #12 file does not exist (or already exists).

    Shell ("S:\Sage\Sage 100 Premium ERP\MAS90\Home\pvxwin32.exe") does fire up pvxwin32.exe fine, so it seems like I'm off the quotes, or something, somewhere. I have tried every variation I can think of without success.

  • 0 in reply to MEI154

    Here is some VBA code to launch a shortcut. This code assumes the shortcut is on the user's desktop. You can modify it point where your shortcut is. The ENVIRON function returns the path to the user's profile.

    Sub Test()

       Dim FileName As String

       FileName = Environ("USERPROFILE") & "\Desktop\" & "test.lnk"

       FileName = "cmd /c " & """" & FileName & """"

       Call Shell(FileName, vbHide)

    End Sub

  • 0 in reply to jimatqsi

    I run mine from Access using a batch file saved on each workstation. Saved on each workstation because a couple of the workstations had different drives.

    Call from VBA:

    strBatch = "D:\Sage\WebOrder_SageImport_ESF.bat"

    Shell strBatch

    Batch File below:

    d:

    CD "D:\Sage\Sage 100 ERP Workstation\MAS90\Home"

    Pvxwin32.exe -hd ..\launcher\sota.ini *Client -ARG "SERVER" "10001" "IMPWEB" -ARG= DIRECT UION USER PWD COMPANY VIWI0R DISPLAY

  • 0 in reply to gseales

    I do the same as gseales, Shell("M:\Insurance_" & sele1.Company & ".bat", vbHide)

    I use the vbHide so a command window does not show.

  • 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!