Default Date problem

K

Ken

I am wanting to set a default value for a date field
through VB. Stepping through the code the date appears to
be set correctly in the Immediate window

?Forms![frmFieldWaterQuality]!txtPurgingDate.DefaultValue
#04/11/61#

The date then displays on the form as 11/04/61. Regional
settings are dd/mm/yy.
 
R

Rick Brandt

Ken said:
I am wanting to set a default value for a date field
through VB. Stepping through the code the date appears to
be set correctly in the Immediate window

?Forms![frmFieldWaterQuality]!txtPurgingDate.DefaultValue
#04/11/61#

The date then displays on the form as 11/04/61. Regional
settings are dd/mm/yy.

When delimited with the # symbol in code or a query you have to use MM/DD/YY
formatting.
 
G

Gassy

Ken

When using dates within VB code they are always dealt with in U.S. format irrespective of the regional settings on your machine. To force the date into the format that you want use the Format() function in your code to produce the correct output.

Cheers

Mark
 
Top