I would like to create an unbound text box within the form itself where i can type in a Name for example and show all records similar to the F3 command is this possible, Im really new to this so any help would be useful
You can certainly do this in a query with something like this. Here is the SQL for a query:
Select *
From tblYourTable
Where tblYourTable.[TargetField] Like "*" & [Enter Search Data] & "*";
Now if you are going to trigger the query from a form then modify the query to this:
Select *
From tblYourTable
Where tblYourTable.[TargetField] Like "*" & Me.[txtTextBoxName] & "*";
Then execute the following code from the OnClick of a command button:
DoCmd.OpenQuery "qryYourQueryname"
Now if you were going to populate a subform that would just require that you requery the subform control after the data was entered in the text box. Me.[yourSFControlName].requery
If you provide me a little more information as to the type of form you are using and how you want the records displayed I can help with setting that up.
Bob Scriver
Hi, I'm trying to do the same thing, add searching that is.
But I can't get your code to work, when I click the command button first a textbox pops up asking me for a parameter, after I enter something anotherone pops up where I also enter something and after clicking OK the query is run and the entire table is shown in the query and the subform remains unaffected.
I posted two different ways to do this.
One where the query prompts for the selection criteria. The second where you use a form to enter the selection data into a text box and then run a query that uses the data from the form to search a table.
The third possibility is to have a form where you enter the selection data on the form and a subform control on that same form displays the records that the query searches for.
Now the code above may not be what you actually want. The code in red had to be updated with your table and field name information to make it work. And the subform had to have the Record Source be the query that is has the references to the text boxes on the form.
Why don't you post your SQL and an explaination of your situation and I will take a look at it for you.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.