sorting yes no fields

G

Guest

I am trying to build a querry with about 10 yes no fields in it. I want only
records that have a yes in any of the 10 different fields. but what ever i
try will not give me any records. i can only get it to work if i put
criteria on only one yes no field but then i am not getting all of the other
records i need. anybody have any ideas
 
P

PC Datasheet

For each field, set the criteria to True but put the criteria in a different
row for each of the ten fields.
Wasn't this answered about a week ago?
 
G

Guest

The where clause should look like this WHERE (((test.[1])=True) or
((test.[2])=True) or ((test.[3])=True)); In query builder you need to put
true in criteria line1 and keep moving down a line in criteria and putting
true in for all 10 fields. In the end there will be a diagonal line of trues.

HTH
Martin J
 
B

Brian

Jon ajl said:
I am trying to build a querry with about 10 yes no fields in it. I want only
records that have a yes in any of the 10 different fields. but what ever i
try will not give me any records. i can only get it to work if i put
criteria on only one yes no field but then i am not getting all of the other
records i need. anybody have any ideas

It would have helped if you'd posted the SQL, but here's the sort of thing
it sounds like you are trying to do:

SELECT yes_no_field_1, yes_no_field_2, yes_no_field_3 FROM some_table
WHERE yes_no_field_1 = True OR yes_no_field_2 = True OR yes_no_field_3 =
True

To build this in the query design view, each criterion in the Criteria grid
would have to go on the row BELOW the criterion for the previous criterion,
so that they slope downwards across the grid. If you put them all in the
top row of the Criteria grid, then you will get AND's instead of OR's, which
is absolutely NOT what you want!
 
S

Steve Schapel

Jon,

In the query designer, make a calculated field like this...
YesNoTest: [Your1stYN]+[Your2ndYN]+ ... +[Your10thYN]
.... and then in the criteria of this column, put <>0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top