Change criteria from option group

M

Matt P

Alright I have a form with various things to manipulate the criteria
in the query. Everything works except for the option group which has
3 options. The first just leaves all the records in which works fine,
the second "SHOULD" remove all of the records that have No. And the
3rd "SHOULD" only have the records that have Yes. Anyone see where I
am going wrong in my query?


SELECT tblCompanies.[Company Name], tblAdjusters.[Last Name],
tblAdjusters.[First Name], tblAdjusters.Address, tblCompanies.City,
tblCompanies.State, tblAdjusters.ZipCode, tblCompanies.Show,
tblAdjusters.Save, tblCompanies.Independent
FROM tblCompanies INNER JOIN tblAdjusters ON
tblCompanies.ID=tblAdjusters.CompanyNumber
WHERE (((tblCompanies.State)=IIf(FORMS!frmMailingList!chkWI,"WI"))) Or
(((tblCompanies.State)=IIf(FORMS!frmMailingList!chkIL,"IL"))) Or
(((tblCompanies.State)=IIf(FORMS!frmMailingList!chkMN,"MN"))) And
((tblCompanies.Show)=Yes) And ((tblAdjusters.Save)=Yes) And
(((tblCompanies.Independent)=IIf(FORMS!frmMailingList!
opgIndAdj=2,No))) Or (((tblCompanies.Independent)=IIf(FORMS!
frmMailingList!opgIndAdj=3,Yes)));


Thanks,
Matt P
 
M

Matt P

Alright I have a form with various things to manipulate the criteria
in the query.  Everything works except for the option group which has
3 options.  The first just leaves all the records in which works fine,
the second "SHOULD" remove all of the records that have No.  And the
3rd "SHOULD" only have the records that have Yes. Anyone see where I
am going wrong in my query?

SELECT tblCompanies.[Company Name], tblAdjusters.[Last Name],
tblAdjusters.[First Name], tblAdjusters.Address, tblCompanies.City,
tblCompanies.State, tblAdjusters.ZipCode, tblCompanies.Show,
tblAdjusters.Save, tblCompanies.Independent
FROM tblCompanies INNER JOIN tblAdjusters ON
tblCompanies.ID=tblAdjusters.CompanyNumber
WHERE (((tblCompanies.State)=IIf(FORMS!frmMailingList!chkWI,"WI"))) Or
(((tblCompanies.State)=IIf(FORMS!frmMailingList!chkIL,"IL"))) Or
(((tblCompanies.State)=IIf(FORMS!frmMailingList!chkMN,"MN"))) And
((tblCompanies.Show)=Yes) And ((tblAdjusters.Save)=Yes) And
(((tblCompanies.Independent)=IIf(FORMS!frmMailingList!
opgIndAdj=2,No))) Or (((tblCompanies.Independent)=IIf(FORMS!
frmMailingList!opgIndAdj=3,Yes)));

Thanks,
Matt P

Well this is for a report but I posted this in the wrong group...
 

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