|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Monthly Report
I'm trying to create a monthly report with totals of a particular value shown per month. I can get it all to work but the month is only showing as an integer (using the month function). Is there any in-built function to give me the name of the month rather than the number. I know in SQL server you can use MonthName but this doesn't work in access.
Any help appreciated. |
|
#2
|
||||
|
||||
|
I could not find a function so I use my own:
Public Function GetMonthName(MonthNum As Byte, Optional LongName As Boolean = True) As String Dim s As String Dim MonthNames(23) As String MonthNames(0) = "January" MonthNames(1) = "February" MonthNames(2) = "March" MonthNames(3) = "April" MonthNames(4) = "May" MonthNames(5) = "June" MonthNames(6) = "July" MonthNames(7) = "August" MonthNames(8) = "September" MonthNames(9) = "October" MonthNames(10) = "November" MonthNames(11) = "December" MonthNames(12) = "Jan." MonthNames(13) = "Feb." MonthNames(14) = "Mar." MonthNames(15) = "Apr." MonthNames(16) = "May." MonthNames(17) = "Jun." MonthNames(18) = "Jul." MonthNames(19) = "Aug." MonthNames(20) = "Sep." MonthNames(21) = "Oct." MonthNames(22) = "Nov." MonthNames(23) = "Dec." If MonthNum >= 1 And MonthNum <= 12 Then If Not LongName Then MonthNum = MonthNum + 11 Else MonthNum = MonthNum - 1 End If s = MonthNames(MonthNum) Else s = "Argument must be between 1 and 12." End If GetMonthName = s End Function
__________________
BRegs, TBÁrpi "I can only show you the door. You're the one who has to walk through it." |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Monthly Report |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|