Date Format in Visual Basic
Hello, i know how to assign a date format text box. I know that to assign a monetary format on tape the following code Text1.Text = Format (Text1.Text ,"##,###. 00 ") but if it is a date format the how ?. Is it possible to change the date format of ms access from mm/dd/yyyy to dd/mm/yyyy ?
Re: Date Format in Visual Basic
Hi
You are experiencing the wonders of MSAccess in US style. This is the default display and read format for Access and cannot directly be changed.
What you can do, tho, is change the data where it is displayed (on form or report).
To do so:
Select the control, then view properties, and change output format to Short Date - this will pick up your windows settings.
Note: In my experience Windows settings are generally only used by ADO command objects and not by access when searching for fields in queries. I am sure that if you have a non-english locale (ie. German) you can use US dates still or DEU Dates, so I think the rule is access assumes all dates are in US format, unless it cannot , then it uses the windows locale.
To test:
search for 11/12/2008 in a uk-english locale, and you'll see Nov 12 2008 records (not, dec 11 2008)
Hope this helps,
Re: Date Format in Visual Basic
Hi,
With VB6, the date format is done with the following example:
Private Sub Command1_Click()
Text1.Text = Format(Text1.Text, "dd/mm/yyyy")
End Sub
Private Sub Form_Load()
Text1.Text = Format(Date, "dd/mm/yyyy")
End Sub