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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top