Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

requetin a particular date vs all dates

Status
Not open for further replies.

billheath

Technical User
Mar 17, 2000
299
US
I have a query with a [Date_New] field. When I open the query, I would like to be able to select all dates or a particular date.

In the criteria for the [Date_New] field, I wrote the expression,
"IIf([For Date]="",>#1/1/2014#,[For Date])"
When I open the query, I am prompted for [For Date] as expected. The query will give me the data for a date that I enter. However, I had hoped it would give me all dates if I left the [For Date] blank and simply pressed "enter".
I have also tried "IIf Isnull([For Date]............ but I get the same results.
What am I doing wrong? Or am I going about this the wrong way?

Thanks for your help, Bill
 
hi,

how about
Code:
"IIf([For Date] [highlight #FCE94F]is null[/highlight],>#1/1/2014#,[For Date])"

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
The criteria should be:
=[For Date] OR Trim([For Date] & "")=""

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you PHV, I would have never gotten that on my own!
Skips might have worked also. I never tried that one. Thanks to you both!!
 
For once, I don't think Skip's suggestion will work since the operator ">" is inside the expression.

I would use the following if there are no nulls in Date_New.

SQL:
Nz([For Date],[Date_New])

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top