D
Don Hicks
I am trying to execute a SQL Server DTS package from Access 2003 using the
following code.
Dim mobjPkgEvents As DTS.Package
'Run the package stored in file
C:\DTS_UE\TestPkg\VarPubsFields.dts.
Dim objPackage As DTS.Package2
Dim objStep As DTS.Step
Dim objTask As DTS.Task
Dim objExecPkg As DTS.ExecutePackageTask
On Error GoTo packageerror
Set objPackage = New DTS.Package
Set mobjPkgEvents = objPackage
objPackage.FailOnError = True
'Create the step and task. Specify the package to be run, and
link the step to the task.
Set objStep = objPackage.Steps.New
Set objTask = objPackage.Tasks.New("DTSExecutePackageTask")
Set objExecPkg = objTask.CustomTask
With objExecPkg
.PackagePassword = "CORP\hicksdl"
'.FileName = "T:\hicksdl\act_dev\sap_file_import.dts"
.Name = "sap_file_import"
End With
With objStep
.TaskName = objExecPkg.Name
.Name = "sap_file_import"
.ExecuteInMainThread = True
End With
objPackage.Steps.Add objStep
objPackage.Tasks.Add objTask
'Run the package and release references.
objPackage.Execute
Set objExecPkg = Nothing
Set objTask = Nothing
Set objStep = Nothing
Set mobjPkgEvents = Nothing
objPackage.UnInitialize
Exit Function
packageerror:
MsgBox "There was an error executing the import.", vbCritical
MsgBox Err.Description
Resume HandleButtonClick_Exit
I get the following error message.
"Invalid Authorization Specification"
I can't seem to find any good documentation on what the various attributes
(Name, Pasword, etc.) should be set to. Can someone steer me in the right
direction. The package is stored in the database and I'd like to execute it
from there. Thanks in advance for your help.
following code.
Dim mobjPkgEvents As DTS.Package
'Run the package stored in file
C:\DTS_UE\TestPkg\VarPubsFields.dts.
Dim objPackage As DTS.Package2
Dim objStep As DTS.Step
Dim objTask As DTS.Task
Dim objExecPkg As DTS.ExecutePackageTask
On Error GoTo packageerror
Set objPackage = New DTS.Package
Set mobjPkgEvents = objPackage
objPackage.FailOnError = True
'Create the step and task. Specify the package to be run, and
link the step to the task.
Set objStep = objPackage.Steps.New
Set objTask = objPackage.Tasks.New("DTSExecutePackageTask")
Set objExecPkg = objTask.CustomTask
With objExecPkg
.PackagePassword = "CORP\hicksdl"
'.FileName = "T:\hicksdl\act_dev\sap_file_import.dts"
.Name = "sap_file_import"
End With
With objStep
.TaskName = objExecPkg.Name
.Name = "sap_file_import"
.ExecuteInMainThread = True
End With
objPackage.Steps.Add objStep
objPackage.Tasks.Add objTask
'Run the package and release references.
objPackage.Execute
Set objExecPkg = Nothing
Set objTask = Nothing
Set objStep = Nothing
Set mobjPkgEvents = Nothing
objPackage.UnInitialize
Exit Function
packageerror:
MsgBox "There was an error executing the import.", vbCritical
MsgBox Err.Description
Resume HandleButtonClick_Exit
I get the following error message.
"Invalid Authorization Specification"
I can't seem to find any good documentation on what the various attributes
(Name, Pasword, etc.) should be set to. Can someone steer me in the right
direction. The package is stored in the database and I'd like to execute it
from there. Thanks in advance for your help.