I have a DTS Package THAT Loops
The function that causes it too loop is at the end of this post.
In part of my loop, I change the datasource to a different access database each time I loop, but the connection never changes. I've experienced this before, and worked around it by executing a second dTS package that did the datapump. Has anyone else tried this. It appears that once I use a connection, I can not change that connections datasource.
How do you change the datasource of a connection after you have used that connection in the DTS package.
'*************************
**********
**********
**********
**********
*****
' Visual Basic ActiveX Script
'*************************
**********
**********
**********
**********
*******
Function Main()
DIM oPkg
Set oPkg = DTSGlobalVariables.Parent
IF DTSGlobalVariables("DestMD
B").Value <> "" THEN
Dim oConn
Set oConn = DTSGlobalVariables.Parent.
Connection
s("Microso
ft Access Copy")
oConn.DataSource = DTSGlobalVariables("DestMD
B").Value
Set oConn = Nothing
oPkg.Steps("DTSStep_DTSAct
iveScriptT
ask_1").Ex
ecutionSta
tus = DTSStepExecStat_Waiting
oPkg.Steps("DTSStep_DTSExe
cuteSQLTas
k_4").Exec
utionStatu
s = DTSStepExecStat_Waiting
oPkg.Steps("DTSStep_DTSDyn
amicProper
tiesTask_2
").Executi
onStatus = DTSStepExecStat_Waiting
oPkg.Steps("DTSStep_DTSDat
aPumpTask_
2").Execut
ionStatus = DTSStepExecStat_Waiting
oPkg.Steps("DTSStep_DTSAct
iveScriptT
ask_4").Ex
ecutionSta
tus = DTSStepExecStat_Waiting
oPkg.Steps("DTSStep_DTSExe
cuteSQLTas
k_5").Exec
utionStatu
s = DTSStepExecStat_Waiting
Main = DTSStepScriptResult_DontEx
ecuteTask
Else
Main = DTSTaskExecResult_Success
END IF
Main = DTSTaskExecResult_Success
End Function
Start Free Trial