MikeJD
06-11-2002, 03:18 PM
I have a query which takes information from an input form. On the form is a combo box based on a table with 3 fields - ID, Division, Criterion. To select records for a particular division, the 'Division' is selected in the combo box but I want the 'Criteron' field to be used in the query. The criterion box in the query is set as 'Forms![Input Form]![Division].[Column](2)' and the entries in the 'Criterion' field are in the form 'Like P*'. When I run the query I get an error message which says 'Undefined expression Forms![Input Form]![Division].[Column]'.
Can anyone suggest where I am going wrong ?
Jack Cowley
06-12-2002, 06:35 AM
Put an unbound, hidden text box on your form. In the after Update event of the combo box set the hidden text box value to column 2. Refer to the text box in your query instead of the code you are using now.
Pat Hartman
06-12-2002, 08:27 AM
You can't supply SQL keywords as part of your criteria. If all the criterion include the keyword "LIKE", change the query's criteria cell to:
Like Forms![Input Form]![YourTextBox]
And remove the keyword like from the table field values. If the reference to the combobox column doesn't work (I think it might not work in a query), then you'll have to take Jack's advice and store the contents of column(2) in a TextBox.
MikeJD
06-13-2002, 03:16 AM
I have added a hidden textbox and revised the criterion in the query as you have suggested. It now works a required.
Many thanks.