I am trying to dynamic-ize a DTS package that imports some DBase III tables into SQL Server using Nigel Rivett's example setting Global Variables. This is the main block of code from a VB projectobjPack.LoadFromSQLServer txtServer, "sa", "", , , , , txtPackName.TextWith objPack .GlobalVariables(3).Value = txtFile.Text 'FileName (Source Dir) .GlobalVariables(2).Value = txtDatabase.Text 'DatabaseName .GlobalVariables(1).Value = txtServer.Text 'ServerName ' now set all the server connections - see below for SetServer SetServer .GlobalVariables(1).Value, .GlobalVariables(2).Value, .GlobalVariables(3).Value .LogFileName = "C:\LogMMImport.txt" For i = 1 To .Tasks.Count If InStr(LCase(.Tasks(i).CustomTaskID), "datapump") > 0 Then Set otsk = .Tasks(i).CustomTask otsk.SourceObjectName = "[" & txtDatabase.Text & "].[dbo]." & Mid(.Tasks(i).Name, InStrRev(.Tasks(i).Name, "["), InStrRev(.Tasks(i).Name, "]") - InStrRev(.Tasks(i).Name, "[") + 1) otsk.DestinationObjectName = "[" & txtDatabase.Text & "].[dbo]." & Mid(.Tasks(i).Name, InStrRev(.Tasks(i).Name, "["), InStrRev(.Tasks(i).Name, "]") - InStrRev(.Tasks(i).Name, "[") + 1) End If Next .ExecuteEnd With
However, the CREATE TABLES from the Source directory specified seem to be OK, but the COPY DATA always fails, even if I reassign the SourceObjectName and DestinationObjectName as above. The log file doesn't give a reason.Sarah Berger MCSD