Reputation: 47
I have a form that contains two text boxes to search for a first name and a last name and a button to run the query. However, when the button is clicked, the enter parameter value dialog box appears for each text feild. Also, I have another textbox and button to search for positions, same thing happens. I created a test database and form at home in access 2007 using the same code (using 2010 at work), and the dialog box doesn't appear. I'm pretty new to access, so it's possible I'm overlooking something. But, I'm clueless to as what it is. I've search here and google for a solution, but nothing has worked. Any help is greatly appreciated.
SELECT dbo_Apptable.AppID, dbo_Apptable.Date, dbo_Apptable.Position, dbo_Apptable.Referral, dbo_Apptable.LastName, dbo_Apptable.FirstName
FROM dbo_Apptable
WHERE (((dbo_Apptable.LastName) Like "*" & Forms![Main Menu]![Last Name] & "*") And ((dbo_Apptable.FirstName) Like "*" & Forms![Main Menu]![First Name] & "*"));
SELECT dbo_Apptable.AppID, dbo_Apptable.Date, dbo_Apptable.Position, dbo_Apptable.Referral, dbo_Apptable.LastName, dbo_Apptable.FirstName
FROM dbo_Apptable
WHERE (((dbo_Apptable.Position) Like "*" & [Forms]![Main Menu]![Position] & "*"));
Upvotes: 1
Views: 2906
Reputation: 97101
You indicated [Main Menu]
is open in Form View when you run those queries and the control names are correct. Yet Access asks you to supply values for the form controls. That means the db engine can't find those form controls, and I don't understand why that is happening.
I suggest you try a simpler query which focuses on only those controls.
SELECT
Forms![Main Menu]![Last Name] AS main_menu_last_name,
Forms![Main Menu]![First Name] AS main_menu_first_name,
Forms![Main Menu]![Position] AS main_menu_position
That query won't cure the problem but it may help avoid distraction from other parts of the queries.
If this simple query also fails, triple-check the names of the form controls. Since you're new to Access, perhaps you have a text box whose caption is "Last Name", but the name of the text box control is actually something like "Text1".
On the other hand, if Access gives you the values of those form controls without error, that means something else in your queries is being interpreted as a parameter.
Upvotes: 2