Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query using multiple combobox selections 1

Status
Not open for further replies.

kklaus

Technical User
Dec 8, 2004
36
US

I need help writing a query using multiple combobox selections. I've done this successfully for one combobox. The part I'm having a problem with is having the query "ignore" comboboxes where the user doesn't make a selection and leaves it blank.

For Example:
I have 4 comboboxes on a form: Underwriter, Office, Unit, and Producer.

If the user selects Producer and Underwriter and does not make a selection for Office and Unit, I want the query to lookup all records that have that Producer AND Underwriter.

I'm thinking I should be using a conditional statement like If Producer <> Null, but I'm not sure how to do this.
 
A starting point:
WHERE
(Table.Producer=comboProducer Or IsNull(comboProducer)) AND
(Table.Underwriter=comboUnderwriter Or IsNull(comboUnderwriter)) AND
(Table.Office=comboOffice Or IsNull(comboOffice)) AND
(Table.Unit=comboUnit Or IsNull(comboUnit))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PVH
Thank you, Thank you, Thank you!!

That was exactly what I need and works great!!!


Kathy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top