Default Date in Form Field

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
 
G

Guest

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

fredg

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)
 
M

Marshall Barton

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)
 

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

Top