Solved

query criteria determined by IIf statement

Posted on 2007-11-15
4
509 Views
Last Modified: 2010-04-21
Hello ~

I'd like to incorporate the following IIf statement into a query criteria:

IIf([forms]![frmMain]![ckConsent]=1,-1)

Implied IF the control value is NOT 1, display all records.
Alternatively, IF the control value is NOT 1, display records w/ -1 or 0 in the field.

Tried:
IF the control value is NOT 1, no records are displayed - as written
IIf([forms]![frmMain]![ckConsent]=1,-1, -1 Or 0)
Does not work.

I appreciate your ideas.
0
Comment
Question by:Chi Is Current
  • 2
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
Rick_Rickards earned 500 total points
ID: 20296299
If I understand what you're trying to do the following in the critera I think will render the result you're after...

<> IIf([forms]![frmMain]![ckConsent],0, 1)

If chkConcent is true then all values with true will be displayed...
If chkConcent is false than all values true and false will be displayed because a boolean field will only contain -1 and  0 for values thus both are <> (not equal to) 1.  In the inverse condition we are saying not equal to 0 which would leave us with only values that are -1.

0
 
LVL 2

Author Comment

by:Chi Is Current
ID: 20296365
Cee Wah!  That's exactly it.

Extra thanks for lightning fast response time and the mind reading. (I think I did not articulate that question very well.)

Interesting the way that works.

Thank you, Jacob
0
 
LVL 2

Author Closing Comment

by:Chi Is Current
ID: 31409500
Exceptional solution & explanation!!!!!!  Blindingly FAST!!!
0
 
LVL 16

Expert Comment

by:Rick_Rickards
ID: 20296403
You're most welcome!!!

Rick
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

746 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

13 Experts available now in Live!

Get 1:1 Help Now