G
Guest
Anyone have a suggestion for easily formatting numbers as ordinals in an
Access report?
Muy thanks.
Access report?
Muy thanks.
Lynn Trapp said:This function should do what you want:
Function Ordinal_Numbers(P_Numeric As String) As String
Dim V_Ordinal As String
Dim V_Numeric As String
If Right(P_Numeric, 2) = "11" Or Right(P_Numeric, 2) = "12" Or
Right(P_Numeric, 2) = "13" Then
Ordinal_Numbers = "th"
Else
V_Numeric = Right(P_Numeric, 1)
Select Case V_Numeric
Case "1"
V_Ordinal = "st"
Case "2"
V_Ordinal = "nd"
Case "3"
V_Ordinal = "rd"
Case Else
V_Ordinal = "th"
End Select
Ordinal_Numbers = V_Ordinal
End If
End Function
Call the function from a query like this:
OrdinalNumber: [YourNumberField] & Ordinal_Numbers(CStr([YourNumberField]))
--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Big List: www.ltcomputerdesigns.com/JCReferences.html
Lulu said:Formatting as Ordinal means if a value in a text box is 7 the value in the
report will read 7th; 11 would read 11th and 21 would read 21st
thanks.
Perhaps some future version of Access would think of this as a needed
Built-In Function.