Year calculation

crackie

New member
Local time
Today, 22:07
Joined
Aug 2, 2004
Messages
7
Hello I am a newbie in this forum. I had designed a database with an input form for data entry. I would want to have a field that could perform a year calculation to calculates an expiry date for something.

Eg; Date of Purchase -> 01/01/2004
Expiry Date -> **to be calculated 5-years from the date above.

I wonder what is the step to perform this function or does it allow this to be done in a form?

Thanks
 
Thanks for the info. I need a little specific detail on the DateAdd function. I am gonna create a new text box to display the expiry date and this is where the DateAdd function will reside.

I appreciate if you could briefly describe how to work with DateAdd on my scenario?

Thanks
 
Try

Private Sub txtPurchaseDate_AfterUpdate()
Me.txtExpiryDate = DateAdd("yyyy", 5, Me.txtPurchaseDate)
End Sub

shay :cool:
 
Even simpler, just put this in the COntrolSource of the tetbox.

=DateAdd("yyyy", 5, [txtPurchaseDate])


Why waste time writing code when you don't need it? ;)

You also might prefer:

=IIf(IsNull([txtPurchaseDate]) "-", DateAdd("yyyy", 5, [txtPurchaseDate]))
 

Users who are viewing this thread

Back
Top Bottom