Getting ErrorLevel from a batch file after called in MS Access vba script RRS feed

  • Question

  •   I would like to know how I can get/check the return code/error level from a batch file I have call from VBA in MS Access.

    1.  I call a batch file from MS Access with the following code:

            If FSO.FileExists(SignName) = True Then
                SignStr = """" & SignPath & """ """ & SignName & """"
                Call Shell(SignStr, 1)

    2.  When I return from calling this batch file, how can I check to see if the errorlevel NE 0.  Here is the code in the batch file:

    if errorlevel 1 goto error

    goto end

    echo Failed with error #%errorlevel%.
    echo "%~1"
    exit /b %errorlevel%


    3.  I also think I may need to change the rrorlevel check to errorlevel NE 0.  This way anything other than a sucessful execution of the command will cause the error handling to be invoked.  Just need to understand how to make the code changes in my MS Access to check for this value not being 0 when I return.

      Any assistance would be greatly appreciated and I thank you in advance.


    Friday, January 4, 2019 10:29 AM

All replies