Combo box returns from query

A

Alex

Hi anyone,

I have two combo boxes in the form:

Customer ID and Order ID.

If the customer id is chosen, then the OrderID displays
only the orders related to that customer.

If there is no customer chosen, then the OrderID combo
displays all orders...

How to do it?

In the query for the Order ID I put:
IIf(([tbl_Orders].[CustomerID])=IsNull([Forms]!
[frm_hlp_Invoices]![cmbCustomer]),True,[Forms]!
[frm_hlp_Invoices]![cmbCustomer]))

With the customer chosen in the combo CustomerID, the
OrderID combo displays all related to that customer
Orders,
with the combo CustomerID empty, the OrderID combo
displays nothing.

where is my mistake?
How to make the OrderID combo display all Orders if the
CustomerID combo is not activated?

thanks for your advice..
 
A

Alex

No need for help. Got it.
If interested, here how I done that.
There is one additional invisible field on the form,
called: bolCustomerChosen, which is by default is False.

On the query itself for the criteria do this(each line
represents a line in criteia):
CustomerID field
Forms!frm_OrderID![cmbCustomer]

Forms!frm_OrderID!bolCustomerChosen field
true
false

Make sure to change the value of bolCustomerChosen into
True when the value of cmbCustomerID is changing.

That is it.
Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top