MonthName Function

  • Thread starter angelinarose via AccessMonster.com
  • 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
 
D

Douglas J. Steele

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
 
M

Marshall Barton

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top