I have a form that shows the results of a query.
I now what to base my search on a field in the form and then click a search button to bring up on the records I am looking for.

I have setup up my query to accept the necessary:
and my form passes my input variable to the query without a problem.
When I click my button which is set to:
OnClick: Me.RecordSource = MyQuery
All the fields on the form give me the #Name? error.

However if I type in my input press the button and open up the query, the query shows the record I want to see in the form.

Any help would be greatly appreciated.