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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search records from button press

Status
Not open for further replies.

zgtrman

Programmer
Dec 4, 2002
62
US
I bet the answer to this one is easy but I just can't see it, I have a table with names and tasks fields and one ID field. everything is text except the ID field. the tasks fields will only contain numbers. What I am trying to do is create a procedure that the user inputs a number in a text box and then clicks the button and it will display all records that contain that number. This has to be generic as possible to allow for expansion on the table.
 
Hi,

Create a query that selects all the relevant fields.
In the criteria row of the particular field that the user wants to filter on type this:

Like '*' & forms!myformname!txtboxname & '*'

Use this query as the displaying forms' recordsource and refresh the form when the user clicks the button.

ATB

Darrylle





Never argue with an idiot, he'll bring you down to his level - then beat you with experience. darrylles@yahoo.co.uk
 
I agree with Darryles. As another option, you can use the filter property of the form/subform.

Main Form...(put textbox in header section?)

Me.Filter = "txtTask = " & forms!myformname!txtboxname
Me.FilterOn = True

subForm...
Me.subForm.Form.Filter = "txtTask = " & forms!myformname!txtboxname
Me.subForm.Form.FilterOn = True

...you said txtTask, was numbers thus, no quotes around search text box...

either way, Good Luck!
 
I would like to thank all who replied to my question...I have since found the solution I was after by using the OR in my query. In as much as the suggestions to this questions did not actually solve my problem...they did put me on the right path.

To effectively improve in the efficiency of your performance, one must be proficient in the implementation of a positive mental attitude.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top