Formatting Dates English into French

Valery

Registered User.
Local time
Yesterday, 20:48
Joined
Jun 22, 2013
Messages
363
I need to format English dates into French i.e. long date in English would be "January 8, 2016" and in French it would be Le 8 janvier 2016.

THANK YOU

-------------------------------------------------------------------------
(see solution on last thread)
 
Last edited:
A table with fields such as
ID MonthE MonthF and values
Code:
1   January  Janvier
2   February Février
3   March    Mars
4   April    Avril
....
12  December Décembre

As Paul said a DLookup

If you want french name for month 3
DLookup("MonthF","yourtablename","ID = 3")

Good luck.
 
I followed advice from one user (Dennisk) and created a table of Months in French and gave each row the default Month Number (1 - 12).

The names of the months in French don't change so there is nothing to gain by storing them in a table and time wasted every time they need to be retrieved from the table.

I would create a FormatFrench function that takes a Date datatype and returns the string in French, just like Format does.
 
Here is what worked great for me:

Copy and insert this function into your database:

Code:
Public Function fnENdate2FR(ByVal vParam As Variant) As String

    Dim arrFrenchMonths As Variant
    
    arrFrenchMonths = Array("janvier", "février", "mars", _
                            "avril", "mai", "juin", _
                            "juillet", "août", "septembre", _
                            "octobre", "novembre", "décembre")
    Debug.Print vParam = "" & vParam
    If Not IsDate(vParam) Then
        fnENdate2FR = vParam
    
    Else
        vParam = CDate(vParam)
        fnENdate2FR = IIf(Day(vParam) = 1, Day(vParam) & "er", Day(vParam)) & " " & _
                            arrFrenchMonths(Month(vParam) - 1) & " " & Year(vParam)
    End If
    
End Function


To apply in a Report Control Textbox, insert the following in the Report Source:

For today's date:
="Le " & fnENDate2FR(Date())

For a date you have in a field:
=fnENDate2FR([your field name])

To use in a Label control, use the Forms Load event to set the caption of this label

Code:
Private Sub Report_Load()
Me.label.Caption = fnENdate2FR(Date)
End Sub

Coding, graciously provided by: arnelgp, MS Access Forum, March 2016

Bonus: For Currency in French, insert (as format): #,##0.00 $;(#,##0.00 $)
 

Users who are viewing this thread

Back
Top Bottom