MonthName Function

  • Thread starter Thread starter angelinarose via AccessMonster.com
  • Start date Start date
A

angelinarose via AccessMonster.com

Hi Gang,
I was just curious about something. Access has a MonthName Function that will
return the Month Name such as January for 1. Is there a QuarterName Function
that will Return for Quarters like 1 would be 1st Quarter, and so on. Or if
not it is possible to make such a function?

thanks for the help!
Angel
 
There's nothing built into Access to do it, but it's pretty simple.

Function QuarterName(WhatDate As Date) As String

Dim lngQuarter As Long

lngQuarter = DatePart("q", WhatDate)
Select Case lngQuarter
Case 1
QuarterName = "1st Quarter"
Case 1
QuarterName = "2nd Quarter"
Case 1
QuarterName = "3rd Quarter"
Case 1
QuarterName = "4th Quarter"
End Select

End Function
 
angelinarose said:
I was just curious about something. Access has a MonthName Function that will
return the Month Name such as January for 1. Is there a QuarterName Function
that will Return for Quarters like 1 would be 1st Quarter, and so on. Or if
not it is possible to make such a function?


Try using an expression like:

=quarterfield & Choose(quarterfield, "st","nd","rd","th") +
" Quarter"
 
Back
Top