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

Name Function with DateAdd

Status
Not open for further replies.

mrfritz44

MIS
Nov 21, 2003
75
US
I want to name a file with the yesterday's date. Here's what I've got, but it's giving me an error:

Name "C:\Program Files\OCEAPC Software\oceDatedOutput\Oce.log" As "C:\Program Files\OCEAPC Software\oceDatedOutput\" & DateAdd("d", -1, Date$)& "_" & Format(Time, "hhnn") & "Oce.log"

Any idea what the corretc syntax is?
 
Probably invalid character(s) for file name.
You may try something like this:
As "C:\Program Files\OCEAPC Software\oceDatedOutput\" & Format(Now-1,"yyyy-mm-dd_hhnn") & "Oce.log"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top