Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User entered data on form to search for data. 1

Status
Not open for further replies.

sirace

MIS
Dec 8, 2003
34
US
Hi,

I have a form where I'd like a user to be able to enter some data and have it pull up related records based on what was entered. For instance, if I have an inventory of products dealing with fruit, my data would look something like this:

item
----
Apple Sauce
Apple Cider
Orange Juice
Apple Juice
Apple Tarts
Orange Peels

etc.

Now I want the user to be able to enter "apple" into a text box for it to pull up all records starting with "Apple". I have some VBA code that will let me do this (from the Access Modules FAQ), but I'm not sure how to implement it. I was thinking of using a text box and putting a command button next to it to run the code. The only thing is I don't know how to pass the contents of the text box into a variable that the button code could have access to. Any help is appreciated.
 
I did the same thing. On my main form, I have a button that opens another form used to get the results they are looking for.

Basically, on the form which is named frmSearch, I have a text box named "searchletter" The user enters as much information as they want the search to look for - In other words, they can just enter "a" or they can enter "apple" - Then, you just need to set up a query that has all of the fields you want the user to see - In the criteria portion for the field that you want to search, enter

Like [forms]![frmsearch]![searchletter] & "*"

Then just add the command button that runs the query.

That should work for you.

Fred
 
Thanks! That's very simple (well for the most part). I thought I'd have to deal with lines of VB code (and I'm no VB coder, mind you!)
 
No problem - let me know if you need more help -

Fred
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top