How to view all records from combo box on form

I have a combo box on a form that passes 6 different annex number sets as parameters to the linked query. These numbers are 0600000, 1502000, 1602000, 1700000, and 1800000. The following line works perfect when selecting those numbers individually and after update, subform query gets refreshed and updated.
[forms]![fr_DailyWOMYPInspectionSelection]![cmb_AnnexDrop] 

Open in new window

I also need to see all records from the query not just when I select individual annexes, and this is where I am having a problem. Currently this is the code I am using as criteria in the query, but its not returning any records when in the dropbox I select empty option, or even a * option.
IIf(IsNull([forms]![fr_DailyWOMYPInspectionSelection]![cmb_AnnexDrop]),"*",[forms]![fr_DailyWOMYPInspectionSelection]![cmb_AnnexDrop])

Open in new window

Can anyone help me with what code I need to have these annexes displayed individually and all at the same time?
toalexsandrAsked:
Who is Participating?
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.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
In your query, define a column as:

[forms]![fr_DailyWOMYPInspectionSelection]![cmb_AnnexDrop]

and include a OR condition of IS Null

This:

IIf(IsNull([forms]![fr_DailyWOMYPInspectionSelection]![cmb_AnnexDrop]),"*",[forms]![fr_DailyWOMYPInspectionSelection]![cmb_AnnexDrop])

 Then is not needed.  Just look at the form control for the criteria check on the number.

Jim.
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
and just to be clear, the SQL will end up as:

<some field> = [forms]![fr_DailyWOMYPInspectionSelection]![cmb_AnnexDrop]

Or

[forms]![fr_DailyWOMYPInspectionSelection]![cmb_AnnexDrop]  Is Null

The later resulting in all records.

Jim.

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
toalexsandrAuthor Commented:
Thanks for quick response, unfortunately its not working...using expression builder...

[forms]![fr_DailyWOMYPInspectionSelection]![cmb_AnnexDrop]  Or Is Null

this returns just 2 blank rows and when selecting individual annexes it adds the blank rows....

My combo box has the following list values, " ", 0600000, 1502000, 1602000, 1700000 and 1800000. Maybe instead of blank I need to have something else?
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

toalexsandrAuthor Commented:
Maybe this will be easier with VBA code?
Jeffrey CoachmanMIS LiasonCommented:
Check your syntax...

Jim's Post:
[forms]![fr_DailyWOMYPInspectionSelection]![cmb_AnnexDrop] Or [forms]![fr_DailyWOMYPInspectionSelection]![cmb_AnnexDrop]  Is Null

Your post:
[forms]![fr_DailyWOMYPInspectionSelection]![cmb_AnnexDrop]  Or Is Null

Try it exactly the way Jim posted it...
toalexsandrAuthor Commented:
Thank you for your help. It worked perfectly. The problem was that I was adding empty line space in my combo box and it was not searching properly.
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.