Hi John,
Ok, here is my code. When I saved the query, Access added parenthesis'. I
keep trying to add the extra ( after Where and an extra ) before and but
access gives me an syntax error. When I run this the filter is not 100%. Am
I missing something?
WHERE (((qry_postmortems_Date.Issue_Platform) Like "*" &
[Forms]![frmPOP_NeilsTrendReports]![txt_NeilsTrendRpt] & "*")) OR
(((qry_postmortems_Date.Issue_Platform) Like "*" &
[Forms]![frmPOP_NeilsTrendReports]![txt_NeilsTrendRpt] & "*") AND
((qry_postmortems_Date.Balboa)=True) AND
(([Forms]![frmPOP_NeilsTrendReports]![chk_Balboa])<>False)) OR
(((qry_postmortems_Date.CapitalMkt_SecondaryMkt)=True) AND
(([Forms]![frmPOP_NeilsTrendReports]![chk_CSC])<>False)) OR
(((qry_postmortems_Date.CIS)=True) AND
(([Forms]![frmPOP_NeilsTrendReports]![chk_CIS])<>False)) OR
(((qry_postmortems_Date.CLD)=True) AND
(([Forms]![frmPOP_NeilsTrendReports]![chk_CLD])<>False)) OR
(((qry_postmortems_Date.CMD_Corp)=True) AND
(([Forms]![frmPOP_NeilsTrendReports]![chk_CMD_Corp])<>False)) OR
(((qry_postmortems_Date.CMD_Remote)=True) AND
(([Forms]![frmPOP_NeilsTrendReports]![chk_CMD_Remote])<>False)) OR
(((qry_postmortems_Date.FSL_Corp)=True) AND
(([Forms]![frmPOP_NeilsTrendReports]![chk_FSL_Corp])<>False)) OR
(((qry_postmortems_Date.FSL_Remote)=True) AND
(([Forms]![frmPOP_NeilsTrendReports]![chk_FSL_Remote])<>False)) OR
(((qry_postmortems_Date.HR)=True) AND
(([Forms]![frmPOP_NeilsTrendReports]![chk_HR])<>False)) OR
(((qry_postmortems_Date.Landsafe)=True) AND
(([Forms]![frmPOP_NeilsTrendReports]![chk_Landsafe])<>False)) OR
(((qry_postmortems_Date.LoanAdmin)=True) AND
(([Forms]![frmPOP_NeilsTrendReports]![chk_LoanAdmin])<>False)) OR
(((qry_postmortems_Date.ProductionTech)=True) AND
(([Forms]![frmPOP_NeilsTrendReports]![chk_PT])<>False)) OR
(((qry_postmortems_Date.TBank)=True) AND
(([Forms]![frmPOP_NeilsTrendReports]![chk_TBank])<>False)) OR
(((qry_postmortems_Date.Wholesale_Corp)=True) AND
(([Forms]![frmPOP_NeilsTrendReports]![chk_Wholesale_Corp])<>False)) OR
(((qry_postmortems_Date.Wholesale_Remote)=True) AND
(([Forms]![frmPOP_NeilsTrendReports]![chk_Wholesale_Remote])<>False))
ORDER BY qry_postmortems_Date.OutageDate;
Thanks for help,
John Vinson said:
WHERE (((qry_postmortems_Date.Issue_Platform) Like "*" &
[Forms]![frmPOP_NeilsTrendReports]![txt_NeilsTrendRpt] & "*")) OR
(((qry_postmortems_Date.Issue_Platform) Like "*" &
[Forms]![frmPOP_NeilsTrendReports]![txt_NeilsTrendRpt] & "*") AND
((qry_postmortems_Date.Balboa)=NZ([Forms]![frmPOP_NeilsTrendReports]![chk_Balboa],0))
AND
The problem is that OR.
If either of the first two criteria are true, the record will be
retrieved REGARDLESS of the values in the checkboxes.
Put an extra left parenthesis after WHERE, and an extra right
parenthesis before the first AND.
And...
****** NORMALIZE YOUR TABLES ********
If you think *this* query is difficult, they'll get a LOT worse (if
you want to do, say, a date range). And the difficulty is all
*unnecessary* - the syntax
WHERE ((((qry_postmortems_Date.Issue_Platform) Like "*" &
[Forms]![frmPOP_NeilsTrendReports]![txt_NeilsTrendRpt] & "*")) OR
(((qry_postmortems_Date.Issue_Platform) Like "*" &
[Forms]![frmPOP_NeilsTrendReports]![txt_NeilsTrendRpt] & "*"))
AND (
(Forms!frmPOP_NeilsTrendReports![chk_Balboa] AND BusinessUnit =
"Balboa")
OR
(Forms!frmPOP_NeilsTrendReports![chk_CIS] AND BusinessUnit = "CIS")
OR
( <etc etc> )
will let you store the data correctly - without multiple yes/no fields
and without storing data in fieldnames - and still allow the user to
query by selecting checkboxes.
John W. Vinson[MVP]