?
Solved

Access Query with Iif

Posted on 2014-12-13
2
Medium Priority
?
210 Views
Last Modified: 2014-12-13
Hi.  I have a user form for folks to run some data-defined reports.  It has a checkbox, asking if they also want to filter by contactID.  (Number) If checked, then they can choose the contact from a list, and the contacts ID is placed in a field called "MyContact".  If the FilterByContact is NOT checked, however, I would like the query to show ALL contacts just filter on the dates.  But the contact criteria is not working and I don't know how to tell it to show ALL contacts when the box is NOT checked.  Any help appreciate.

Here is the Query Criteria I have in the ContactID field:
IIf([Forms]![frmDateInputForm]![FilterByContact]=True,[forms]![frmDateInputForm]![MyContact],*)

It all works fine except when needing to show ALL.

Thanks,
0
Comment
Question by:Not2ruthless
[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
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 40498200
try this

IIf([Forms]![frmDateInputForm]![FilterByContact]=True,[forms]![frmDateInputForm]![MyContact],[ContactID])
0
 

Author Closing Comment

by:Not2ruthless
ID: 40498215
Thanks SO much!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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.
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

741 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