Question : MS Access change regular number to month in query

In an Access query how to I convert a number such as 1, 2, 3 to a month such as Jan, Feb, Mar?

Answer : MS Access change regular number to month in query

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
eg of function, create in a standard code module:
Function fnReturnMonth(iNumber As Integer) As String
    Select Case iNumber
        Case 1
            fnReturnMonth = "Jan"
        Case 2
            fnReturnMonth = "Feb"
        Case 3
            fnReturnMonth = "Mar"
        Case 4
            fnReturnMonth = "Apr"
        Case 5
            fnReturnMonth = "May"
        Case 6
            fnReturnMonth = "Jun"
        Case 7
            fnReturnMonth = "Jul"
        Case 8
            fnReturnMonth = "Aug"
        Case 9
            fnReturnMonth = "Sep"
        Case 10
            fnReturnMonth = "Oct"
        Case 11
            fnReturnMonth = "Nov"
        Case 12
            fnReturnMonth = "Dec"
    
    End Select
  
End Function

then call the funtion in your query:
select fnReturnMonth(numberfield) as "MyMonth", 
	field1, field2 .....etc
from your_table
Random Solutions  
 
programming4us programming4us