Name of the month in English

  • Thread starter Thread starter MisterTibbs
  • Start date Start date
M

MisterTibbs

Guest
My problem: I work on a German machine (i.e. the regional settings are set for Germany) but have created reports in Access where the name of the month needs to appear in English. Is there a way to do this without monkeying with the regional settings?

Thanks in advance...
 
How about a function?

Code:
Public Function EMonths(ByVal dteTemp As Date) As String
    On Error GoTo Err_EMonths

    Select Case Month(dteTemp)
    
        Case Is = 1: EMonths = "January"
        Case Is = 2: EMonths = "February"
        Case Is = 3: EMonths = "March"
        Case Is = 4: EMonths = "April"
        Case Is = 5: EMonths = "May"
        Case Is = 6: EMonths = "June"
        Case Is = 7: EMonths = "July"
        Case Is = 8: EMonths = "August"
        Case Is = 9: EMonths = "September"
        Case Is = 10: EMonths = "October"
        Case Is = 11: EMonths = "November"
        Case Is = 12: EMonths = "December"
        
    End Select ' Month(dteTemp)
    
    Exit Function ' EMonths
    
Err_EMonths:
    EMonths = vbNullString

End Function ' EMonths
 
Looks great!

If I weren't so inept, I'd probably know where to plug this into and how to call it up :o Maybe you could give me a short "walk through" and I won't have to bother you the next time something like this comes up?

Sorry but, when it comes to Access, my ignorance knows no bounds :D

Thanks, again...
 
In the database window, go to the modules tab, and create a new module.

Copy and past the VBA in to that module.

You can now use the function the same way you would use any other function in a query, report, or form by simply passing a date to it.


i.e.


=EMonths([txtMyDate])


SELECT EMonths([MyDate]) As EnglishMonth
FROM MyTable;


etc.
 
SJ,

Why "Case Is = 1", rather than just "Case 1"?

Is there a difference or is it just a style thing so it matches things like "Is > 1"?

Dave
 
Got it. Don't let anyone tell you you're not the best.

Eternally indebted...
 

Users who are viewing this thread

Back
Top Bottom