OK. There are probably a number of ways to get round this 'problem.' Before describing a possible way may I state my understanding of the situation. This ensures I am not answering the wrong problem.
You have nested subforms to two levels. The master/parent form is called 'order.' (You do not name the control that displays the intermediate form but for now this is not important.)
The intermediate form is called 'itemqueryform2.' This form contains a command button called 'runquerybutton.' Clicking this button requeries the lowest level (child) subform. The control that displays this child subform is called 'itemquery2_subform.' The intermediate form contains a combo box called 'combo2' and a text box called 'text4.' The values in these controls are used for filtering the content of the child subform.
You don't say what the lowest level form is called but for now this is not important.
Assuming the above you need to do two things:- Remove the WHERE clause from the SQL behind the child subform. This eliminates the prompts issued by Access thinking you have named parameters.
- Change the code behind 'runquerybutton' to be:
Code:
Me!itemquery2_subform!Form.Filter = "itemname Like ""*" & Me!Text4 & "*"" AND restaurant = """ & Me!combo2 & """"
Me!itemquery2_subform!Form.FilterOn = True
I think I've got the quotes right in the first line (but I wouldn't be surprised if I haven't). I think FilterOn triggers a requery - can't remember offhand.
You could be more fancy testing for "" before forming the filter.
May I encourage you to start following a naming standard.