Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems running DTS package remotely

Status
Not open for further replies.

jtrembla

ISP
Jul 6, 2006
104
US
I can successfully run the DTS package from SQL SERVER, but my vba script (from MS Access) fails. It runs the package, but it fails at every step. I even tried supplying the sa username and password. It seems to be a permissions issue somewhere, I just can't find it.

I gave myself owner permissions of the database and system admin.

Here is my code

Code:
Function RunPackage()

Const DTSSQLStgFlag_Default = 0
Const DTSStepExecResult_Failure = 1

Dim oPkg As Package
Dim oStep, sMessage, bStatus
    
Set oPkg = New DTS.Package
oPkg.LoadFromSQLServer "Myserver", "sa", "Mypassword", DTSSQLStgFlag_Default, "PackagePassword", "", "", "PackageName"
oPkg.Execute
    
    bStatus = True
    
    For Each oStep In oPkg.Steps
        sMessage = sMessage & " Step [" & oStep.Name & "] "
        If oStep.ExecutionResult = DTSStepExecResult_Failure Then
            sMessage = sMessage & " failed"
            bStatus = False
        Else
            sMessage = sMessage & " succeeded"
        End If
        sMessage = sMessage & "Task " & oPkg.Tasks(oStep.TaskName).Description
    Next
    
    If bStatus Then
        sMessage = sMessage & "Package [" & oPkg.Name & "] succeeded"
    Else
        sMessage = sMessage & "Package [" & oPkg.Name & "] failed"
    End If
    
    MsgBox sMessage
    MsgBox "Done"
    
End Function

Any Help would be great, this is annoying me.
 
enable logging for the package, run your task again from your Access app, once it is finished, go back and look at the log for the package it will tell you why it failed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top