Default Date in Textbox

JPR

Registered User.
Local time
Today, 13:53
Joined
Jan 23, 2009
Messages
202
Hello,

I would like to add two unbound text boxes on a form which indicate the 1st day of the current year (txtFrom) and the current date (txtTo).

Thank you for your help.
 
=DateSerial(Year(Date()),1,1)
=Date()
 
You probably already know this - but - if you also want to have control over exactly how the date appears - you could use the Format() command along with those Date functions to yield very specific results. (If you needed YYYY-MM-DD for example, you could use: Format(Date(),"YYYY-MM-DD"), that kind of thing.)
 
Format() is for display. If you need to use the field as a date, do not use Format(). You can easily control how a date is displayed on a form or report by using the Format property of the control. This does not change the underlying value of the control to text. It leaves the control as a date data type.
 
Format() is for display. If you need to use the field as a date, do not use Format(). You can easily control how a date is displayed on a form or report by using the Format property of the control. This does not change the underlying value of the control to text. It leaves the control as a date data type.
Indeed - I was thinking only for display purposes... :)
 
The ONLY time I format a date with Format() in a query is if the query will be used to export data to Excel or some app where you need to control how a date looks because the default is in appropriate. All other formatting is done using the control properties.
 

Users who are viewing this thread

Back
Top Bottom