Code for SaveAs to filename + System Date + System Time

  • Thread starter Thread starter EagleOne
  • Start date Start date
E

EagleOne

2003 up-to-date

How to save current project with current project filename + Current Date + Current Time

? Date() in Immediate Window - Returns date with "/" which cannot be used in a filename.

Therefore, how can I SaveAs a CurrentProject.name + Date + Time in a "new" filename?

Or kinda-like -

DoCmd.Save CurrentProject.Path & "\" & CurrentProject.name & Date????? & Time ?????

TIA EagleOne
 
I am learning about Access VBA which has different capabilities when compared to Excel VBA.

Just experimenting, I came up with" myFilename &" "& Replace(Date, "/", "-") & " " & Time()

Thanks for all those who spent any time on my request.

EagleOne
 
EagleOne,

Not only that, but a Macrto in Access is quite a different creature, and
a VBA procedure is not called a macro.

Preferable to the way you have used the Replace() function, would be to
use the Format() function. For example:
" & myFilename & " " & Format(Date,"dd-mm-yy") & " " & Time

Or perhaps even better still:
" & myFilename & " " & Format(Date + Time,"dd-mm-yy hh:nn")
 
Or perhaps even better still:
" & myFilename & " " & Format(Now,"dd-mm-yy hh:nn")

<g>
 
Back
Top