Subtract a year

W

Walter

When you enter a month and day in a control(short date) Access assumes the
current year. This works great except in January if you're entering December
records. I would like to subtract a year if the assumed date is greater than
today in the BeforeUpdate Event. I've tried Me.TripDate = DateAdd("yyyy",
-1, [TripDate]) but get an error message that says this is preventing update.
The control then shows the month and day with no year.
 
W

Walter

I haven't tried it yet but it looks like just what I'm looking for.
--
Thanks for your help!
Walter


Allen Browne said:
Walter, see if this helps:
Intelligent handling of dates at the start of a calendar year
at:
http://allenbrowne.com/func-AdjustDateForYear.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.


Walter said:
When you enter a month and day in a control(short date) Access assumes the
current year. This works great except in January if you're entering
December
records. I would like to subtract a year if the assumed date is greater
than
today in the BeforeUpdate Event. I've tried Me.TripDate = DateAdd("yyyy",
-1, [TripDate]) but get an error message that says this is preventing
update.
The control then shows the month and day with no year.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top