Solved

query criteria determined by IIf statement

Posted on 2007-11-15
4
542 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
[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
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

734 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