Syntax for Access Query using Dates

Posted on 2013-09-20
Medium Priority
Last Modified: 2013-09-20
What is the correct syntax for the following:
I am trying to write a query which evaluates whether today's date is between two dates - - if so, then perform a calculation, else Null.  I'm having trouble with the date syntax.

This is what I have tried:

Expr:  IIf(Date() > #[BeginningDate]# and < #[EndingDate]# , [PerformCalculation] ,Null)

Thank you.
Question by:rsb1222
1 Comment
LVL 15

Accepted Solution

Ess Kay earned 2000 total points
ID: 39509556
Firstly, you need More than OR EQUAL >= and less than OR EQUAL <=
Secondly, after AND you need a complete statement not <ENDDATE

 IIf(Date() >= [BeginningDate] and Date() < [EndingDate] , [PerformCalculation] ,Null) AS NAMEYOURNEWFIELD

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
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…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

587 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