Solved

Need help with query

Posted on 2014-10-02
5
170 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 36

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 36

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

Independent Software Vendors: 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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

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