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

Date stamp file with VBA 1

Status
Not open for further replies.
Jan 27, 2004
63
CA
I am using Access vba. A text file is copied from the server to a network
drive.
What I am trying to do is copy this file form one folder to another.
Except when the file is copied to the destination, I also want to
include a date stamp in the file name.

Following is what I am using and it is not working. Any help would be
appreciated.


Public Function CopyKill()
Dim OldName, NewName


OldName = ("Z:\MED_SERVICE\Block Hours\Downloads\To
Download\hours.txt"):

NewName = ("Z:\MED_SERVICE\Block
Hours\Downloads\Old downloads\hours.txt") _
& Date()


Name OldName As NewName


End Function

 
OldName = "Z:\MED_SERVICE\Block Hours\Downloads\To
Download\hours.txt"

NewName = "Z:\MED_SERVICE\Block
Hours\Downloads\Old downloads\hourst" & Date() & ".txt
 
NewName = "Z:\MED_SERVICE\Block
Hours\Downloads\Old downloads\hourst" & Date[!]$[/!]() & ".txt"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That did not work Jerry.

It crased on the follwoing line

"Name OldName As NewName"

and the error message was:

RUN TIME ERROR 53
FILE NOT FOUND
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top