Hi,
I'm looking to use ActiveX in a DTS to copy a file from on elocation to another.
I have the code for this (attached below kindly supplied by a colleague), so that's cool.
dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")
If filesys.FileExists("D:\Credits\Credits_MTD.mdb") Then
filesys.CopyFile "D:\Credits\Credits_MTD.mdb", _
"C:\Credits\Credits_200602.mdb"
End If
But what I'm looking to do is go one step further.
As you can see, it renames the file to yyyymm, but this is hard coded, and I'm looking for a coded solution so I can rename the file with yesterday's date.
Can anybody help me please?declare a variable path,get year,month,day-1 from system date,concatnate all and concatnate again with ur file path.
pass that variable.|||Cheers - sorry to be a apin but is it something like this:
dim newDate
newDate = FormatDateTime( Now()-1 , yyyymmdd )
....\Credits_" & NewDate & ".mdb"
I tried that, and it came back with Path Not Found|||Cheers - sorry to be a apin but is it something like this:
dim newDate
newDate = FormatDateTime( Now()-1 , yyyymmdd )
....\Credits_" & NewDate & ".mdb"
I tried that, and it came back with Path Not Found
Unforunatly I dont have vb platform to test it.
create the variable first and pass that variable.
dim path
path="C:\Credits\Credits_"&NewDate&".mdb"
filesys.CopyFile "D:\Credits\Credits_MTD.mdb", path|||Cheers,
Will try that now.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment