I am trying to set up an anniversary date field. This meaning 365 days from todays date. How would I go about doing this?
Thank-you
Cheeco
I am trying to set up an anniversary date field. This meaning 365 days from todays date. How would I go about doing this?
Thank-you
Cheeco
annDate = dateadd("yyyy",1,[MyDate])
Ok. Where do I put that peice of code Ranman256.
in a query :dateadd("yyyy",1,[MyDateField])
or
in a form:
=dateadd("yyyy",1,txtBoxDate)
OK I don't think I was clear as to what I was looking to do. I apologize for that. I have a start date in a field for a member. I also have a field for a anniversary date. Say I put in today's date as a start date. What is want to do is have the anniversary date automatically set to one year from today's date according to the date I out in as a start date. I did try both the form and the query and I could not get either to work. I am using Access 2016.
Don't store this date, calculate it from your start date - otherwise you will have to recalculate it every time the anniversary date passes.
So in the query you make a calculated field
This should work at any time of the year (provided I've counted the brackets up properly...)Code:AnniveraryDate: IIf(DateSerial(Year(Date()),Month([YourStartDate]),Day([YourStartDate]))<Date(),DateSerial(Year(Date()),Month([YourStartDate]),Day([YourStartDate])),DateSerial(Year(Date())+1,Month([YourStartDate]),Day([YourStartDate])))
DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
Please use the star below the post to say thanks if we have helped !
↓↓ It's down here ↓↓
It is working. Thanks for all the help.