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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Script to Dynamically Copy File?

Status
Not open for further replies.

smedvid

MIS
May 28, 1999
1,228
US
First attempt to create DB Script in a DTS...
Goal is to dynamically construct an MDB file (with date/time in file name) which will be the target to an export of 3 lookup tables from SQL Server.
But I get an error on "Set lcSourceFile". Am I missing something?

Any other approaches or suggestions welcomed...

<code>
Function Main()
Set oMyPackage = DTSGlobalVariables.Parent
Dim lcSourceFile
Dim lcTargetFile
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
Set lcSourceFile = "\\server\files\Template.MDB"
Set lcTargetFile = "\\server\files\VVL_2009_xx.MDB"
FSO.CopyFile lcSourceFile, lcTargetFile, True
oMyPackage.Connections("Export_MDB").DataSource = lcTargetFile
Main = DTSTaskExecResult_Success
End Function
</code>



Steve Medvid
IT Consultant & Web Master

Chester County, PA Residents
Please Show Your Support...
 
Got it... Little cut & paste error...
Set lcSourceFile = "\\server\files\Template.MDB"
Set lcTargetFile = "\\server\files\VVL_2009_xx.MDB"
Should be
lcSourceFile = "\\server\files\Template.MDB"
lcTargetFile = "\\server\files\VVL_2009_xx.MDB"



Steve Medvid
IT Consultant & Web Master

Chester County, PA Residents
Please Show Your Support...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top