Code for SaveAs to filename + System Date + System Time

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
 
E

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
 
S

Steve Schapel

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")
 
D

Douglas J. Steele

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

<g>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top