troubleshooting Question

and/or condition in Querry

Avatar of urjudo
urjudoFlag for United States of America asked on
Microsoft Access
16 Comments1 Solution397 ViewsLast Modified:
Hi Experts,
I'm working on a query, I have a combo box in a form, here is my query, what I want to do is: I want user to be able to search either they select data from the combo box or not.  If they don't select the combo box then query will show all the records that they checked, if the select from the combo box then show all the records that match all the check boxes plus the combo box.  Do I need to have two queries? I would like to use one query.  below is my query:

SELECT DISTINCT tblBriefBank.BBID, tblBriefBank.BBCase, tblBriefBank.BBDocket, tblBriefBank.BBChildDOB, tblBriefBank.BBPAtty, tblBriefBank.BBPAttyFirm, tblBriefBank.BBMTPD, tblBriefBank.BBDispostition, tblBriefBank.BBJudge, tblJudge.JDName, tblBriefBank.BBDateRuling, tblBriefBank.BBTranscript, tblBriefBank.BBAppBrief, tblBriefBank.BBAppDescision, tblBriefBank.BBIRA, tblBriefBank.BBIRB, tblBriefBank.BBIRC, tblBriefBank.BBIRD, tblBriefBank.BBIRE, tblBriefBank.BBIRF, tblBriefBank.BBIRG, tblBriefBank.BBIRH, tblBriefBank.BBIRI, tblBriefBank.BBIRJ, tblBriefBank.BBIRK, tblBriefBank.BBIRL
FROM tblBriefBank INNER JOIN tblJudge ON tblBriefBank.BBJudge = tblJudge.JDCode
WHERE (((tblBriefBank.BBMTPD)=[forms]![frmASAInquiry]![Text135]) AND ((tblBriefBank.BBIRA)=[forms]![frmASAInquiry]![BBIRA]) AND ((tblBriefBank.BBIRB)=[forms]![frmASAInquiry]![BBIRB]) AND ((tblBriefBank.BBIRC)=[forms]![frmASAInquiry]![BBIRC]) AND ((tblBriefBank.BBIRD)=[forms]![frmASAInquiry]![BBIRD]) AND ((tblBriefBank.BBIRE)=[forms]![frmASAInquiry]![BBIRE]) AND ((tblBriefBank.BBIRF)=[forms]![frmASAInquiry]![BBIRF]) AND ((tblBriefBank.BBIRG)=[forms]![frmASAInquiry]![BBIRG]) AND ((tblBriefBank.BBIRH)=[forms]![frmASAInquiry]![BBIRH]) AND ((tblBriefBank.BBIRI)=[forms]![frmASAInquiry]![BBIRI]) AND ((tblBriefBank.BBIRJ)=[forms]![frmASAInquiry]![BBIRJ]) AND ((tblBriefBank.BBIRK)=[forms]![frmASAInquiry]![BBIRK]) AND ((tblBriefBank.BBIRL)=[forms]![frmASAInquiry]![BBIRL])) OR (((tblBriefBank.BBJudge)=[forms]![frmASAInquiry]![Combo140]));

This query shows all the records but if I select from the combo box then it's not working, I know it needs to be AND and OR, but could not figure it out how.

Thanks,
ASKER CERTIFIED SOLUTION
Hamed Nasr
Retired IT Professional

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 16 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 16 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros