G
Guest
Have a table with a series (20 ) off yes/no fields ( likely a mistake , but
here I am). Have a form allowing user to choose one or two of these fields
with a check ; this form is read by a query and a report is generated .
trouble is instead of getting logical AND's (which the query calls for)I
get logical Ors ; that Is I want only records with both "gym" and "adult"
checked.
This of course works:
SELECT *
FROM inquiry
WHERE ( (inquiry.adult)=forms!inq_query!adult)
And
( (inquiry.junior)=forms!inq_query!junior);
but when I added all 20 on each side of t he and, it failed , leading me to
try this union query , which to my surprise did not
SELECT *
FROM inquiry
WHERE
( (inquiry.adult)=(forms!inq_query!adult =-1))
or
( (inquiry.junior)=(forms!inq_query!junior=-1))
UNION select * from inquiry
WHERE
( (inquiry.adult)=(forms!inq_query!adult =-1))
or
( (inquiry.junior)=(forms!inq_query!junior=-1));
My first attempt was similar to the first but for 20 "or's" followed by an
"
AND" and then 20 more or's ; it fails for now obvious reasons .
substituting a "AND" for the union statement fails too .
Is there no other way but to programmatically read the page, pick out which
check box's are checked and build a query string similar to the first query
above ? Again , I have 20 possible choices ..
here I am). Have a form allowing user to choose one or two of these fields
with a check ; this form is read by a query and a report is generated .
trouble is instead of getting logical AND's (which the query calls for)I
get logical Ors ; that Is I want only records with both "gym" and "adult"
checked.
This of course works:
SELECT *
FROM inquiry
WHERE ( (inquiry.adult)=forms!inq_query!adult)
And
( (inquiry.junior)=forms!inq_query!junior);
but when I added all 20 on each side of t he and, it failed , leading me to
try this union query , which to my surprise did not
SELECT *
FROM inquiry
WHERE
( (inquiry.adult)=(forms!inq_query!adult =-1))
or
( (inquiry.junior)=(forms!inq_query!junior=-1))
UNION select * from inquiry
WHERE
( (inquiry.adult)=(forms!inq_query!adult =-1))
or
( (inquiry.junior)=(forms!inq_query!junior=-1));
My first attempt was similar to the first but for 20 "or's" followed by an
"
AND" and then 20 more or's ; it fails for now obvious reasons .
substituting a "AND" for the union statement fails too .
Is there no other way but to programmatically read the page, pick out which
check box's are checked and build a query string similar to the first query
above ? Again , I have 20 possible choices ..