Calculating Dates

  • Thread starter Thread starter Bill Mills
  • Start date Start date
B

Bill Mills

I have two text boxes on a form called txtBeginningDate
and txtEndingDate. When the form opens, a message box
appears and asks the users for a beginning date and an
ending date. I have two additional boxes called
txtLastYearsBeginningDate and txtLastYearsEndingDate that
I want to automatically be populated with whatever the
user inputs in the messge box minus 1 year. So for
example, if I open a form, a message box pops up with what
is the begging date and I put 1/1/03, the main form would
have 1/1/03 in the txtBeginningDate box and 1/1/02 in the
txtLastYearsBeginningDate box. Same with end year. Any
ideas on how to do this?
 
I have two text boxes on a form called txtBeginningDate
and txtEndingDate. When the form opens, a message box
appears and asks the users for a beginning date and an
ending date. I have two additional boxes called
txtLastYearsBeginningDate and txtLastYearsEndingDate that
I want to automatically be populated with whatever the
user inputs in the messge box minus 1 year. So for
example, if I open a form, a message box pops up with what
is the begging date and I put 1/1/03, the main form would
have 1/1/03 in the txtBeginningDate box and 1/1/02 in the
txtLastYearsBeginningDate box. Same with end year. Any
ideas on how to do this?

Set the Control Source of txtLastYearsBeginningDate to

=DateAdd("yyyy", -1, [txtBeginningDate])

and similarly for ending date. If the last years' dates are stored in
your table... don't; calculate them on the fly instead.
 
Back
Top