Same query in multiple fields (1 Viewer)

Brewsi

New member
Local time
Today, 19:09
Joined
Mar 2, 2016
Messages
9
Hi there,
This seems like it should be a simple question bit for the life of me can't figure it out.

I have multiple fields in a table.
I want to run a query that says

If any field reads "no" then show record in query,

I am not proficient in SQL bit am using the query tool. I have put "no" in all of the Or criteria but it brings me back no data

Can anyone help please

Thank you in advance
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:09
Joined
May 7, 2009
Messages
19,246
on query design, add another calculated field:

Instr("" & [field1] & [field2] & [field3] & [fieldNth], "no")
Criteria: > 0
 

plog

Banishment Pending
Local time
Today, 13:09
Joined
May 11, 2011
Messages
11,665
In design view, you would stagger your criteiria. That means for the first field you would put 'No' on the first criteria line, for the second field you would put 'No' on the second criteria line, third field--third criteria line, etc.
 

Brewsi

New member
Local time
Today, 19:09
Joined
Mar 2, 2016
Messages
9
Hi there

Thanks for your replies

I have staggered the Or option like you said but I have run out of lines. Is there any way to increase the amount of ORs?
 

plog

Banishment Pending
Local time
Today, 13:09
Joined
May 11, 2011
Messages
11,665
You could go into the SQL and repeat the patter in the WHERE clause. However, arnelgp's advice might be better.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 13:09
Joined
Feb 28, 2001
Messages
27,298
If you have that many items, I wonder if your problem is an original design issue. That question and your responses to the replies make me wonder if you are looking at a case of a "repeating field" where you should really have a parent/child relationship. The individual yes/no answers would be recorded in child records associated with of the parent record. Then you could use a

Code:
DCount("[Answ]","childtable","([Answ]=False) AND ([QuestionID]=" & cstr(Qnumber) & ")" )
 

Brewsi

New member
Local time
Today, 19:09
Joined
Mar 2, 2016
Messages
9
I think you made be right in as much as the design of the db is incorrect. I am quite new to this and still making mistakes

arnglgp does that code allow for unlimited fields?
DOCMAN do you know of any good material to guide through db structure. As I have a lot of data to capture under one record.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:09
Joined
May 7, 2009
Messages
19,246
sir, you have to try it with whatever field you have with "no" value.
 

Users who are viewing this thread

Top Bottom