473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Query criteria yes/no field problem

64 64KB
Hi,

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.
THIS WORKS FINE

When [yesno_rap_grl] is not checked i get all the records that have the field [tr_eig_grl] true.
THIS IS NOT WHAT I WANT

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,
Pierkes
Apr 1 '14 #1
5 2428
jimatqsi
1,271 Expert 1GB
Pierkes,
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)
  2.  
Jim
Apr 1 '14 #2
Rabbit
12,516 Expert Mod 8TB
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
Pierkes
64 64KB
@Rabbit
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
Rabbit
12,516 Expert Mod 8TB
For that outcome, jimatqsi's solution will work for you.
Apr 3 '14 #5
NeoPa
32,556 Expert Mod 16PB
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

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

Similar topics

5
by: Steve | last post by:
I need help with a function to be used as the criteria for a query. The field in the query is InventoryStatus: - . The function is built around a Select Case set of about twelve cases. Function...
1
by: John Baker | last post by:
Hi; Dumb question, but I have a query and i want to accept the record if a field is blank. I have tried criteria of ="", isempty(Fieldame) and a rich variety of other things with no joy. How do...
7
by: keliie | last post by:
Hello Just a quick question that I've spent a few hours trying to solve with no luck (although one would think this should be fairly easy). I have a form with a subform. The subform is based...
3
by: stevecat | last post by:
Hi there, I have created a form, "search" and a query "search_product". The query returns the product information based upon the criteria for three of the fields, author, title or isbn. The field...
4
waynetheengineer
by: waynetheengineer | last post by:
Hi, I was wondering if anyone had any suggestions on my database: I have a form that accepts user input into a single text box. When the OK button is hit, a query should search for all records...
3
by: ericargent | last post by:
Hi I'm using Acces 2003 I have Query where the several parameters for the criteria are supplied from a form. One parameter source is a combo box. What I am trying to do is if: An item is...
3
by: sfrvn | last post by:
I have searched high and low and cannot find an answer to my problem. So now I turn to the collective genius of this newsgroup. Over-simplified examples This query criteria for field works:...
17
by: sharsy | last post by:
Hello guys, I would like some help in generating query criteria that will identify credit cards that have expired on an access database. The specific Field is formatted with a Data Type of...
1
Cintury
by: Cintury | last post by:
Hello, In my query there are two items I want as the criteria. One is the date, and the other is an ID generated from a table. The problem is the table that generates this ID generates it as text...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.