french date

D

Database User

My database is an english database but one letter is in french and i need the
date that is a field in the database to come out in french how can i do this

please give step by step instructions
thanks
 
D

Database User

no i do need to be able to do calculations with the dates.

is there no other way?
 
D

Douglas J. Steele

You could write your own function to translate the date field into a French
string.
 
D

Database User

if you could lead me to the page on your website where my question is
answered it would help.........!!
 
D

Douglas J. Steele

Sorry, I don't have any functions on my page to format date fields into
French...

What you need would be something like:

Function FrenchDate(DateToFormat As Date) As String

Dim strMonth As String
Dim strWeekday As String

Select Case Month(DateToFormat)
Case 1
strMonth = "janvier"
Case 2
strMonth = "février"
Case 3
strMonth = "mars"
Case 4
strMonth = "avril"
Case 5
strMonth = "mai"
Case 6
strMonth = "juin"
Case 7
strMonth = "juillet"
Case 8
strMonth = "août"
Case 9
strMonth = "septembre"
Case 10
strMonth = "octobre"
Case 11
strMonth = "novembre"
Case 12
strMonth = "décembre"
End Select

Select Case Weekday(DateToFormat, vbSunday)
Case vbSunday
strWeekday = "dimanche"
Case vbMonday
strWeekday = "lundi"
Case vbTuesday
strWeekday = "mardi"
Case vbWednesday
strWeekday = "mercredi"
Case vbThursday
strWeekday = "jeudi"
Case vbFriday
strWeekday = "vendredi"
Case vbSaturday
strWeekday = "samedi"
End Select

FrenchDate = strWeekday & ", " & Day(DateToFormat) & _
" " & strMonth & ", " & Year(DateToFormat)

End Function
 
D

Database User

Hi looks like i'm getting there but i'm not so familiar with functions so
where do i put this function. The date that i want to format as a french date
is in a letter and theres a whole paragraph in an unbound box. So where do i
put the date function

thanks for all your help
 
D

Douglas J. Steele

Create a new Module, and put that code there. (Do not name the Module
FrenchDate: modules cannot have the same name as subs or functions contained
in the application.)

You can either use the function in a query, so that you've got:

SELECT Field1, Field2, FrenchDate(MyDate) AS DateToUse FROM MyTable

or you can set the Control Source for a textbox using the function:

=FrenchDate(MyDate)
 
D

Database User

Hi i'm a bit new at this so if you could explain slowly!!!

I pasted the function into a module and saved it as Module1--french. Then
module is there but when i click on the modules tab in the database window i
dont see it - is that ok.

Also the (Datetoformat as date) that you wrote in the function is that what
i should put in the module or should i replace it with my field?


Now i want to do the query part but where do i go to bring a field based on
the module and on the date fields that i want?

Thanks a million for all your help
 
D

Douglas J. Steele

What don't you see on the Modules tab: Module1--french or FrenchDate? You
should see the former, you shouldn't see the latter. Make sure you pasted
the function into a "stand-alone" module, not the module associated with a
form.

Do not change anything in what I wrote for the FrenchDate function.
DateToFormat is the name of the parameter that the function uses: you pass a
value to the function, and it refers to the value you passed as
DateToFormat.
 
D

Database User

Hi! yes sorry about that i do see it now in the modules window as
Module1--french
i didnt change anything in the module

i guess i'm up to the next stage now. Where do i put the module do i bring
it into the query that the report is based on.

Just to remind you again that the date is part of a unbound box (text box)
with a few lines of text and fields in it.

thanks for all!
 
D

Douglas J. Steele

I showed two different ways to use the query.
You can either use the function in a query, so that you've got:

SELECT Field1, Field2, FrenchDate(MyDate) AS DateToUse FROM MyTable

or you can set the Control Source for a textbox using the function:

=FrenchDate(MyDate)
 
D

Database User

thanks i'm a bit slow but it finally clicked - thanks so much for putting up
with me and for all your patience.

It works its amazing - never new anything about modules before...........!!!
 
Top