Change criteria from option group

  • Thread starter Thread starter Matt P
  • Start date Start date
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
 
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...
 
Back
Top