Solved

Need help with query

Posted on 2014-10-02
5
172 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 37

Accepted Solution

by:
PatHartman earned 400 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 100 total points
ID: 40359274
In Access:
=IIF((YEAR(date) MOD 4)=0,date+365,date+366)
0
 
LVL 37

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

726 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