Filtered Query from a form value

I have a form that has 2 fields Division and class that if a value is populated in each my query is filtered by this criteria. However I must specify a value in both these fields or blank records are returned. How can I modify the code so that if any of the 2 fields are not populated I still see all the records.
TIA

[Forms]![Master Form]![Division]
[Forms]![Master Form]![Class]
_HectorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Can you post the SQL of the query?
_HectorAuthor Commented:
Sure,


SELECT [REPORT DBASE].IFITEM, [REPORT DBASE].ICDSC1, [REPORT DBASE].IFQOH, [REPORT DBASE].IFQPO, [REPORT DBASE].IFQBO, [REPORT DBASE].IFAVU, [REPORT DBASE].IFTRAN, [REPORT DBASE].IFQBT, [REPORT DBASE].AVGX6, [REPORT DBASE].IFSMTD, [REPORT DBASE].ICMAST, [REPORT DBASE].ICDIV, [REPORT DBASE].ICCLS
FROM [REPORT DBASE]
WHERE ((([REPORT DBASE].ICDIV)=[Forms]![Master Form]![Division]) AND (([REPORT DBASE].ICCLS)=[Forms]![Master Form]![Class]))
ORDER BY [REPORT DBASE].IFITEM;
Jeffrey CoachmanMIS LiasonCommented:
Try this:

SELECT [REPORT DBASE].IFITEM, [REPORT DBASE].ICDSC1, [REPORT DBASE].IFQOH, [REPORT DBASE].IFQPO, [REPORT DBASE].IFQBO, [REPORT DBASE].IFAVU, [REPORT DBASE].IFTRAN, [REPORT DBASE].IFQBT, [REPORT DBASE].AVGX6, [REPORT DBASE].IFSMTD, [REPORT DBASE].ICMAST, [REPORT DBASE].ICDIV, [REPORT DBASE].ICCLS
FROM [REPORT DBASE]
WHERE ((([REPORT DBASE].ICDIV)=[Forms]![Master Form]![Division] Or [Forms]![Master Form]![Division] Is Null) AND (([REPORT DBASE].ICCLS)=[Forms]![Master Form]![Class] Or [Forms]![Master Form]![Class] is Null))
ORDER BY [REPORT DBASE].IFITEM;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

thekneeCommented:
Try to put or instead of and


 
WHERE ((([REPORT DBASE].ICDIV)=[Forms]![Master Form]![Division]) or (([REPORT DBASE].ICCLS)=[Forms]![Master Form]![Class]))

Open in new window

Jeffrey CoachmanMIS LiasonCommented:
theknee,

The issues with switching to OR is that if both parameters are left blank, no records are returned.


JeffCoachman
_HectorAuthor Commented:
Sweet!
Thank you.
Jeffrey CoachmanMIS LiasonCommented:
Thanks _Hector!

;-)

Jeff
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.