Returning package completion status

  • I'm running a DTS package from Access with code along the lines of the below, which works fine. My issue is with the code which checks the ExecutionResult property, which returns a fail for any tasks on an OnFailure workflow which (ideallly) never get executed. How can I return the execution status of the package, rather than that of the individual steps?

    Set oPKG = New DTS.Package

    Dim sServer As String, sUsername As String, sPassword As String

    Dim sMessage As String

    Dim lErr As Long, sSource As String, sDesc As String

    PackageName="MyPackage"

    sServer = "Server1"

    Fail = 0

    oPKG.LoadFromSQLServer sServer, , , DTSSQLStgFlag_UseTrustedConnection, , , , PackageName

    For Each oStep In oPKG.Steps

    oStep.ExecuteInMainThread = True

    Next

    oPKG.Execute

    For Each oStep In oPKG.Steps

    If oStep.ExecutionResult = DTSStepExecResult_Failure Then

    oStep.GetExecutionErrorInfo lErr, sSource, sDesc

    sMessage = sMessage & "Step """ & oStep.Name & _

    """ Failed" & vbCrLf & _

    vbTab & "Error: " & lErr & vbCrLf & _

    vbTab & "Source: " & sSource & vbCrLf & _

    vbTab & "Description: " & sDesc & vbCrLf & vbCrLf

    Fail = Fail + 1

    Else

    sMessage = sMessage & "Step """ & oStep.Name & _

    """ Succeeded" & vbCrLf & vbCrLf

    End If

    Next

    --
    Scott

  • Sorry, I 've never tried this.  Why not post this in the DTS forum instead?

     

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply