0
votes

I have multiple combo-boxes with a query that filters one after the other (drill-down) and the last combo-box selection shows the records via subform-query.

My concern is if I leave any combo-box without selection (blank) the the result is blank. How do I change the default to * instead of blank?

I followed other recommendation from StackOverflow without success. I've tried to set the combo-box value to Like "*" and like <combo-box> & "*", it does not work.

All suggestions are really appreciated.

In my code, I am checking if combo-box is null, then * else use combo-box selection:

In my Query:

Field = Customer
Table = tblCustomer
Criteria = IIf(IsNull([Forms]![frmRSC]![cboCustomer]),[Forms]![frmRSC]![cboCustomer] Like "*",[Forms]![frmRSC]![cboCustomer])
1

1 Answers

1
votes

The trick is using the control value like a query field in criteria:

WHERE (Customer = [Forms]![frmRSC]![cboCustomer] OR [Forms]![frmRSC]![cboCustomer] IS NULL)

Expression is true if[Forms]![frmRSC]![cboCustomer]is Null (the value of empty ComboBox).

See Show All Records if Form Control is Left Empty