Date format with forward and back slashes

MadeCurler

enthusiastic pensioner
Local time
Today, 12:19
Joined
Dec 6, 2007
Messages
49
I used a piece of code to pass a date from a form to a report.

BeginDate = Format(TxtStartDate, "\#mm\/dd\/yyyy\#")

I've spent hours trying to figure out what the second argument means...why the forward and back slashes?
 
format recognizes mm, dd and yyyy if you want to enter characters not recognized you put \ in front of it and format will just "print" it... So in your example TxtStartDate would become #mm/dd/yyyy# and the #'s is showing it's a date, like "text" or 'text' and in this case #date#. Therefore you see mm/dd/yyyy and Access knows it's a date!~)
 
The backslash indicates the following character is to be inserted literally.

Otherwise in a date format the forward slash is a placeholder for the system date separator. While the system date separator is almost always a forward slash, the backslash ensures that a forward slash will be inserted regardless of the system date format.
 
Thank you both for your prompt replies.....greatly appreciated
 

Users who are viewing this thread

Back
Top Bottom