How to format a date.

message from Julian Milano on 9 May 2004
I have a database which has dates in all sorts of formats, 2-digit,
CaseStats: IIf(IsNull([DateClosed]),"[ CASE OPEN ]",[DateClosed])

It looks for a null date field and replaces the nulls with "[ CASE OPEN ]".
But how do I format the [DateClosed] field to be in the format "dd/mm/yyyy"
irrespective of the actual data's format?
 
Julian Milano replied to Julian Milano on 9 May 2004
IIf(IsNull([DateClosed]),"[ CASE
OPEN ]",Format([DateClosed],"dd-mmm-yyyy")) AS CaseStats
 
Julian Milano replied to Julian Milano on 10 May 2004
I want to have the following output for each condition:

CASE OPEN
[04/12/2004]

Ie. I want to put the square brackets around the dates only, using my
"format" line below. How do I do this? I've tried, but the brackets don't
come out since I think they are like a reserved character in Access!?
 
Brendan Reynolds replied to Julian Milano on 10 May 2004
Use a back-slash character to indicate that the character that follows is to
? format$(date(),"\[dd/mm/yyyy\]")
[10/05/2004]

Note the back-slash characters in front of the "[" and "]" characters.
 
Julian Milano replied to Brendan Reynolds on 11 May 2004
Thanks- it worked!
 

Archived message: How to format a date. (MS Access Error Message)