Solved

Parameter query to pull all data if no value entered.

Posted on 2011-02-13
4
413 Views
Last Modified: 2012-06-27
Using Access 2002, I have a table with a date field.  I want to setup a paramter query that will either pull data as of a certain date entered or pull all data if no date is entered.  I can get the first part, but when no value is keyed I get no results.  How can I do this?
0
Comment
Question by:vsllc
  • 3
4 Comments
 
LVL 75
ID: 34885398
Example:

SELECT Table1.*
FROM Table1
WHERE (((Table1.NotifyByDate)=IIf(IsNull([Enter Date]),[NotifyByDate],[Enter Date])));


mx
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
ID: 34885403
Change YourDateFieldName to the Name of your actual date field.

SELECT Table1.*
FROM Table1
WHERE (((Table1.YourDateFieldName)=IIf(IsNull([Enter Date]),[YourDateFieldName],[Enter Date])));

mx
0
 

Author Comment

by:vsllc
ID: 34885577
Works!  Thanks.
0
 
LVL 75
ID: 34885582
You are welcome ...
mx
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now