This Formula works.
DC: DateDiff("yyyy",[DominionServiceDate],[Expiry-Date]+1)
I have created a new query and want to change the formula to give an answer based on today's date, not the Expiry date.
TY
This Formula works.
DC: DateDiff("yyyy",[DominionServiceDate],[Expiry-Date]+1)
I have created a new query and want to change the formula to give an answer based on today's date, not the Expiry date.
TY
Try
DC: DateDiff("yyyy",[DominionServiceDate],Date()+1)
I have tried this several different times.
Date() returns a number that is one too high. When I remove +1 it continues to return a number one too high. When I change it too -1 it continues to return the number at 1 too high. I tried +5 and it returned a number that is one number too high.
You are adding 1 day to the date or 5 if you use 5.I have tried this several different times.
Date() returns a number that is one too high. When I remove +1 it continues to return a number one too high. When I change it too -1 it continues to return the number at 1 too high. I tried +5 and it returned a number that is one number too high.
You need to understand code that you are using?
Just what would you expect to get from
Was your expiry date always the last date in the year?Code:tt=#03/14/2022# ? DateDiff("yyyy",tt,Date()+1) 2
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Your code returns the number of years between two dates specified. Is that what you want?I have tried this several different times.
Perhaps give us some sample values of DominionServiceDate and what you want as result.
TY very much.
I got it now.
I was adding one day not one year.
I needed to come up with a new formula because many folks have expiry dates well beyond 2024.
And to answer your question below Yes; the expiry day date is always 31 Dec and the Service Date is always 1 Jan
Again TY