I'm currently building a User Interface the launchs dts packages from VB. I am trying to use a timer control to measure elapsed time(time it takes for the dts to run).
Currently the timer will run by itself without triggering the DTS to run. If I want the DTS to run and timer to start and show the elapsed time in a label.caption. How can I get both events to run at the same time.
With the code below. The DTS will run then timer starts running once that package has ran. Help!
Set oPackage = New DTS.Package
oPackage.LoadFromSQLServer "<server>", , , DTSSQLStgFlag_UseTrustedConnection, , , , "<package name>"
'$$$$$$$$$$$$$$$$$$$$$$$$$$ Timer Start $$$$$$$$$$$$$$$$$$$$$$$$$$
Screen.MousePointer = vbHourglass
If Timer1.Enabled = False Then
Timer1.Enabled = True
End If
'$$$$$$$$ Set Exec on Main Thread $$$$$$$$$$
For Each ostep In oPackage.Steps
ostep.ExecuteInMainThread = True
Next
oPackage.Execute
Screen.MousePointer = vbNormal
'Get Status and Error Message
For Each ostep In oPackage.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
Else
sMessage = sMessage & "Step """ & ostep.Name & _
""" Succeeded" & vbCrLf & vbCrLf
End If
Next
'$$$$$$$$$$$$$$$$$$$$$$$$$$$ Timer Stop $$$$$$$$$$$$$$$$$$$$$$$$$$$$
'Timer1.Enabled = False
oPackage.UnInitialize
Set ostep = Nothing
Set oPackage = Nothing
' Display Results
MsgBox sMessage
'