how do i calculate a date based on another variable field in a for

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I want to calculate a renewal date in a form (in a new field) based on a
variable contained in a combo box - i.e. The user enters a date in a field in
the form, and a renewal date is calculated based on a variable chosen in a
combo box. The variables will be:"Yearly", "Half Yearly", "Quarterly" or
"Monthly".
e.g. in the form "Renewals", I type a date in "DateLastPaid" field, I then
choose the appropriate "RenewalFrequency" from a combo box (e.g. "Yearly",
"Half Yearly", "Quarterly" or "Monthly"). The result is shown in the
"DateRenewalDue" field.
Many thanks to all those who read this question, and special thanks in
advance to those who are willing to assist.
Rgds. David (Australia)
 
You can use the DateAdd function.

Your combobox could have 2 columns (one hidden, if you like), with the 2nd
column being the number of months to add: 12, 6, 3, or 1. Once the
particular renewal period has been selected, you can then pick up the 2nd
column's value and plug it into the DateAdd function:

Me.DateRenewalDue = DateAdd("m", Me.cboRenewal, Me.DateLastPaid)
 
Back
Top