?
Solved

Need help with query

Posted on 2014-10-02
5
Medium Priority
?
174 Views
Last Modified: 2014-10-03
how to determine leap year in access query and add 365 days and it the year is not leap add 366
i know how to do in excel but not in access

=IF(MOD(YEAR(date),4)=0,date+365,date+366)
thank you for your help
0
Comment
Question by:rfedorov
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 38

Accepted Solution

by:
PatHartman earned 1600 total points
ID: 40357944
You don't need to do that.  Use the correct function and Access will handle the problem for you.

= DateAdd("yyyy", 1, Date())

Access has a number of date functions.  I recommend getting a list and becoming familiar with what they are used for.
0
 
LVL 30

Assisted Solution

by:hnasr
hnasr earned 400 total points
ID: 40359274
In Access:
=IIF((YEAR(date) MOD 4)=0,date+365,date+366)
0
 
LVL 38

Expert Comment

by:PatHartman
ID: 40359595
hnasr,
That is not the correct formula for determining leap year.  I hate to be pedantic but it was code like that which caused the Y2K "crisis".  I don't understand why you would simply not use the appropriate function.
0
 

Author Closing Comment

by:rfedorov
ID: 40359784
thanks you very much
0
 
LVL 30

Expert Comment

by:hnasr
ID: 40360257
Welcome!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question