Date field addition

S

Stephanie

Hi. I have 2 fields: DateOfLastRenewal and DueDate.
DueDate = DateOfLastRenewal + 2 years.

How can I get DueDate to automatically populate?

Thanks,
Stephanie
 
D

Dirk Goldgar

Stephanie said:
Hi. I have 2 fields: DateOfLastRenewal and DueDate.
DueDate = DateOfLastRenewal + 2 years.

How can I get DueDate to automatically populate?

Set its ControlSource to the expression

=DateAdd("yyyy", 2, [DateOfLastRenewal])

Note that, because this is a calculated value, it won't be stored in
your table. So long as it can be calculated from DateOfLastRenewal
whenever you need it, there's no need to store it. If there's some
reason you need to be able to update it independently, though, then
another mechanism must be used.
 
W

Wayne Morgan

Normally, Due Date shouldn't be a field, it should just be a calculated
control on a form or report. Calculate the value whenever you need it using
DateAdd.

Example Control Source for the DueDate textbox:
=DateAdd("yyyy", 2, [DateOfLastRenewal])
 
S

Stephanie

Wayne,
Thanks for the help and the design lesson!
Cheers,
Stephanie
-----Original Message-----
Normally, Due Date shouldn't be a field, it should just be a calculated
control on a form or report. Calculate the value whenever you need it using
DateAdd.

Example Control Source for the DueDate textbox:
=DateAdd("yyyy", 2, [DateOfLastRenewal])

--
Wayne Morgan
MS Access MVP


Hi. I have 2 fields: DateOfLastRenewal and DueDate.
DueDate = DateOfLastRenewal + 2 years.

How can I get DueDate to automatically populate?

Thanks,
Stephanie


.
 
S

Stephanie

Dirk,
Thanks for the help from alias Stephm. Afterall, you
wrote most of my therapy animals database anyway! Any
chance you'd answer my question in modulesdaovba:
Recordset and DoCmd.Sendobject question?
I appreciate your efforts and have learned a lot.
Cheers,
Stephanie
-----Original Message-----
Hi. I have 2 fields: DateOfLastRenewal and DueDate.
DueDate = DateOfLastRenewal + 2 years.

How can I get DueDate to automatically populate?

Set its ControlSource to the expression

=DateAdd("yyyy", 2, [DateOfLastRenewal])

Note that, because this is a calculated value, it won't be stored in
your table. So long as it can be calculated from DateOfLastRenewal
whenever you need it, there's no need to store it. If there's some
reason you need to be able to update it independently, though, then
another mechanism must be used.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 
Top