Syntax for criterion (1 Viewer)

MikeJD

New member
Local time
Today, 01:32
Joined
Mar 8, 2002
Messages
9
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

Registered User.
Local time
Today, 01:32
Joined
Aug 7, 2000
Messages
2,639
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

Super Moderator
Staff member
Local time
Yesterday, 20:32
Joined
Feb 19, 2002
Messages
43,445
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

New member
Local time
Today, 01:32
Joined
Mar 8, 2002
Messages
9
I have added a hidden textbox and revised the criterion in the query as you have suggested. It now works a required.
Many thanks.
 

Users who are viewing this thread

Top Bottom