Solved

Parameter query to pull all data if no value entered.

Posted on 2011-02-13
4
419 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 - 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

789 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