Passing Paramaters

B

brian

I am using a union query to have a select all option in the combo box. The combo box has an after_update event procedure that assigns the result to a text box. The VBA code is

If isnull(me.cboCustomer) Then
me.txtCustomer = "Like " & chr(34) & "*" & chr(34)
Else me.txtCustomer = me.cboCustomer

If the All option is slected which is "Null" then I get an Expression is too complex in the Form record source I am passing it to. If I select an option with a value it works fine. Also, if i go to the form record source and enter Like "*" in the CustomerID criteron box then it works fine. Why wont it work if passing it? Is there something else I should be doing? Is there a better way to get all the values if selecting from a combo box?

Thanks for any suggestions.
 
D

Dirk Goldgar

brian said:
I am using a union query to have a select all option in the combo
box. The combo box has an after_update event procedure that assigns
the result to a text box. The VBA code is

If isnull(me.cboCustomer) Then
me.txtCustomer = "Like " & chr(34) & "*" & chr(34)
Else me.txtCustomer = me.cboCustomer

If the All option is slected which is "Null" then I get an Expression
is too complex in the Form record source I am passing it to. If I
select an option with a value it works fine. Also, if i go to the
form record source and enter Like "*" in the CustomerID criteron box
then it works fine. Why wont it work if passing it? Is there
something else I should be doing? Is there a better way to get all
the values if selecting from a combo box?

Thanks for any suggestions.

I think we need to see the code where you build the recordsource from
the value of the text box. You might also set a breakpoint and examine
the value of the recordsource string you've built. Post that too, if
the flaw isn't obvious.
 

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