Solved

query criteria determined by IIf statement

Posted on 2007-11-15
4
527 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to execute an access 2007 module from vb6 2 35
Create a EXCEL FIle from Access Procedure 1 14
Access Open Report with SQL Parameter 11 30
Switch 5 16
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

770 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