By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,842 Members | 2,198 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,842 IT Pros & Developers. It's quick & easy.

Query criteria yes/no field problem

P: 64

Iám having problems with a criteria in a query. The field is a yes/no field.

I have a yes/no field on a form which i can check of uncheck. The field is called [yesno_rap_grl].

In the query criteria i have;

Expand|Select|Wrap|Line Numbers
  1. IIf([Forms]![frm_rapporten].[yesno_rap_grl]=True;False;([tbl_trajecten].[tr_eig_grl])=True Or ([tbl_trajecten].[tr_eig_grl])=False)
The result i get is;

When [yesno_rap_grl] is checked i get all the records except the ones that have the field [tr_eig_grl] true.

When [yesno_rap_grl] is not checked i get all the records that have the field [tr_eig_grl] true.

When [yesno_rap_grl] is not checked i want to get all the records regardless if the field [tr_eig_grl] is true of false.

Does anybody have an idea on how to write the right line in the "criteria" portion of the query ?

Thanks in advance for your help !!!
Best regards,
Apr 1 '14 #1
Share this Question
Share on Google+
5 Replies

Expert 100+
P: 1,221
Use this, and test it for <>0
Expand|Select|Wrap|Line Numbers
  1. iif([Forms]![frm_rapporten].[yesno_rap_grl]=True,-1- [tr_eig_grl] ,-1)
Or if you prefer something more straight-forward
Expand|Select|Wrap|Line Numbers
  1. iif([Forms]![frm_rapporten].[yesno_rap_grl]=True,iif([tr_eig_grl] ,false,true),true)
Apr 1 '14 #2

Expert Mod 10K+
P: 12,335
What you say you want, what you say is happening, and what the code does gives completely different outcomes.

Please fill out this logic grid.
Expand|Select|Wrap|Line Numbers
  1. [yesno_rap_grl] [tr_eig_grl] result
  2. checked         checked      ?
  3. checked         unchecked    ?
  4. unchecked       checked      ?
  5. unchecked       unchecked    ?
Apr 1 '14 #3

P: 64
Please fill out this logic grid.
Expand|Select|Wrap|Line Numbers
  1. [yesno_rap_grl] [tr_eig_grl] result
  2. checked         checked      - select all records where tr_eig_grl is not checked
  3. checked         unchecked    - select all records where tr_eig_grl is not checked
  4. unchecked       checked      - Select all records
  5. unchecked       unchecked    - Select all records
Apr 3 '14 #4

Expert Mod 10K+
P: 12,335
For that outcome, jimatqsi's solution will work for you.
Apr 3 '14 #5

Expert Mod 15k+
P: 31,306
The information you posted indicates that [tr_eig_grl] is irrelevant and has no bearing on what is shown. Is that a correct understanding or is your last post in error (See specifically lines #2 & #3)?
Apr 3 '14 #6

Post your reply

Sign in to post your reply or Sign up for a free account.