Solved

Parameter query to pull all data if no value entered.

Posted on 2011-02-13
4
422 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
[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
  • 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 - Microsoft MVP, Access and Data Platform) 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

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
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

624 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