Convert Numbers to words for Month

Jolted_Chicken

Registered User.
Local time
Today, 21:51
Joined
Nov 7, 2002
Messages
15
I am trying to convert Month numbers to words
eg. 1 -> January, 4 -> April

but i cant get it working....

I've looked at some examples involving converting currency into words but havnt got me anywhere

here's my code for the module MonthNum2Word(int)
Code:
Option Compare Database

Option Explicit
Public Static Function MonthNum2Word(ByVal month_int As Integer) As String
Dim month_word As String

Select Case (month_int)
Case 1:
    month_word = "January"
Case 2:
    month_word = "Febuary"
Case 3:
    month_word = "March"
Case 4:
    month_word = "April"
Case 5:
    month_word = "May"
Case 6:
    month_word = "June"
Case 7:
    month_word = "July"
Case 8:
    month_word = "August"
Case 9:
    month_word = "September"
Case 10:
    month_word = "October"
Case 11:
    month_word = "November"
Case 12:
    month_word = "December"
End Select

'Return Month in words
MonthNum2Word = month_word

End Function

I am trying to call this in a text label where in its control value
i've put
=MonthNum2Word([Forms]![fmrMonthlyReports]![ComboMonth])

[Forms]![fmrMonthlyReports]![ComboMonth] is a combo box that allows me to select the month for a query.
 
Where does your combo box get its data from? Is the source is a table or a value list? I feel a value list would suit your needs, os chenge the row source type to value list and the row source to January;February;March etc
HTH
Dave
 
Function MonthSay(intMonth As Integer) As String

Dim strMoYr

If intMonth < 1 Or intMonth > 12 Then
MsgBox "Enter a number between 1 and 12", vbExclamation, "Try Again"

Else
strMoYr = DateValue(intMonth & "/" & Year(Date))
MonthSay = Format(strMoYr, "mmmm")
End If

End Function
 
JC, try the following

month_word = CHOOSE(month_int,"January","February","March".........)
 

Users who are viewing this thread

Back
Top Bottom