Default Date in Form Field

  • Thread starter Thread starter Helen
  • Start date Start date
H

Helen

Hi,

I have created a form that I use as criteria for a query. The user enters a
Start Date and an End Date by either typing it in or using a Calendar.

Is there a way I can set the default date in the Start Date field to be the
first of the previous year; 01/01/04 and the End Date to be the last date in
the previous month (also previous year) i.e. 10/31/04?

Thanks!

Helen
 
txtStartDate = DateSerial(Year(Date)-2, 12, 32)
txtEndDate = Dateserial(Year(Date)-1,Month(Date),0)
 
Hi,

I have created a form that I use as criteria for a query. The user enters a
Start Date and an End Date by either typing it in or using a Calendar.

Is there a way I can set the default date in the Start Date field to be the
first of the previous year; 01/01/04 and the End Date to be the last date in
the previous month (also previous year) i.e. 10/31/04?

Thanks!

Helen

Set the Default Value property of the StartDate control to:
DateSerial(Year(Date())-1,1,1)

Set the Default Value property for the EndDate control to:
DateSerial(Year(Date())-1,Month(Date()),0)
 
Helen said:
I have created a form that I use as criteria for a query. The user enters a
Start Date and an End Date by either typing it in or using a Calendar.

Is there a way I can set the default date in the Start Date field to be the
first of the previous year; 01/01/04 and the End Date to be the last date in
the previous month (also previous year) i.e. 10/31/04?


Set the text box's DefaultValue property to:

DateSerial(Year(Date())-1,1,1)
and
DateSerial(Year(Date())-1,Month(Date())+1,0)
 
Back
Top