Question : Date Format problem in Microsoft Access 2000

I already set the date format in the table and in the form (see vehicle.jpg)
now user can enter date format 28/12/2009 with no problems.
but when user enters 01/12/2009 which is 01 Dec 2009, before tabbing to the next field (see entering date value.jpg),
the user presses tab now (see tab to next field.jpg),
you can see the date is now changed to 12/01/2009 which is 12 Jan 2009, it is wrong!!!
my god.....I'm so upset with that, I do not know why it always use US format............
anyone can help?

Answer : Date Format problem in Microsoft Access 2000

Ok, that makes things a little trickier....

You need to work out how separate the different values.

Use the OnLostFocus event of the unbound textbox.

In it put:
Date = datevalue(dd & "\" & mmm & ", " & yyyy)

However, I advise you not to use "Date" as one of your field names as it is a reserved word. I suggest something like "RegistrationDate" perhaps.

E.g. (I have also called the unbound textbox "tbx_Date" in the code below.)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
Private Sub RegistrationDate_LostFocus()
  Dim dd As Integer
  Dim mmm As Integer
  Dim yyyy As Integer
  
  dd = CInt(Left(tbx_date, InStr(1, tbx_date, "/") - 1))
  mmm = CInt(Mid(tbx_date, InStr(1, tbx_date, "/") + 1))
  yyyy = CInt(Mid(tbx_date, InStrRev(tbx_date, "/") + 1))
  
  RegistrationDate = DateValue(dd & " " & MonthName(mmm) & ", " & yyyy)
End Sub
Random Solutions  
 
programming4us programming4us