Serializing a file name by datetime

M

Matt Rich

I'm creating a backup routine for a database. Due to the need for 24/7
access, the best I can do at the moment is to use FILECOPY. Here's the
problem: I have a requirement to serialize by the date and time of the
backup. Here's what I have:

DFile = "\\serverloc\application\Backups\SEbak_" & _
Format(Now(), "dd") & "-" & Format(Now(), "mm") & "-" & _
Format(Now(), "yy") & "_" & Format(Now(), "hh") & _
Format(Now(), "???") & Format(Now(), "ss") & ".mdb"

The question marks indicate the problem area. "min" returns the month
number, the letter "i", and something or the other else. How do I return the
minutes portion of a datetime value?
 
A

Allen Browne

Use n for miNutes.

Try:
Format(now(), "dd\-mm\-yy\_hhnnss") & ".mdb"

The backslash indicates the next character is a literal.
 
M

Matt Rich

Boy is my face red - found the details of the custom formats in the Access
Help just before returning...however, your solution is much cleaner. Thanks!
 
Top