1st Jan preferred but 1 Jan acceptable
On Sat, 05 Aug 2006 13:49:13 +1000, Robin Chapple wrote:
I have a birthday list which I need to publish without the birth year
displayed.
How do I show 1st Jan 1970 as 1st Jan?
Thanks,
Robin Chapple
Do you mean display it as 1 Jan or literally as 1st Jan?
To display the date of birth as 1st Jan:
Copy and Paste the below function into a new module.
Public Function DateOrdinalEnding(DateIn, MoIn As String)
' Will add an Ordinal ending to a date, i.e. 13th Jan, 2nd Feb, etc.
' MoIn determines Month Format, i.e. "mmm" for "Feb" or "mmmm" for
"February"
If IsNull(DateIn) Then
DateOrdinalEnding = ""
Exit Function
End If
Dim dteX As String
dteX = DatePart("d", DateIn)
dteX = dteX & Nz(Choose(IIf((Abs(dteX) Mod 100) \ 10 = 1, 0,
Abs(dteX)) Mod 10, "st", "nd", "rd"), "th")
DateOrdinalEnding = dteX & Format(DateIn, " " & MoIn)
End Function
==================
You can call it from a query:
BirthdayOn

ateOrdinalEnding([DateOfBirth],"mmm")
or directly in a report or on a form, using an unbound text control:
=DateOrdinalEnding([DateOfBirth],"mmm")