I am trying to create a search form that can search from one table at a time based on the table selected by the user from a combo-box. I have a text box called searchCriteria and the combo-box is called TableList. The idea is that if the user wanted to search customer_table, she would select “customer_table” in the combo box, enter her search criteria in the text box, and press the search button. If she wanted to search order_table, she would select that table from the combo-box and so on. I would like the query to return all full records pertaining to the criteria entered. So, for example, if the user searched “James” from the customer table, I would like the full records (all fields) returned where the criteria “James” is present:
Company | First Name | Last Name | Account # | Sales Rep Jammy Juice | James | Dan | 555 | Jim Halbert Jameson Car Shop | Tom | Cramb | 556 | Dwight Smiles Landon Refrigeration | Bob | McVance | 557 | James Bland
From my understanding, this will require some VBA to write a query…
I am assuming the query would be something like the following: SELECT t.* FROM customer_table t WHERE (t.*)::text LIKE '%James%';
Where the string entered (James) and the table name (customer_table) are entered by the user.
Simply, I'm having trouble getting the form data (the table name and search text) into my query.
Does anyone know how to implement this in Microsoft Access 2010? Any insight would be appreciated.