Solved

Access Query with Iif

Posted on 2014-12-13
2
188 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
2 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now