Solved

Access Query with Iif

Posted on 2014-12-13
2
198 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 500 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

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.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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 …

733 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