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

Text boxes and queries 1

Status
Not open for further replies.

benkov

Programmer
Jun 16, 2004
13
GB
I have a form bringing values from a query and inserting them into text boxes.

The records can be navigated using 'next and previous' buttons but I would also like the facility to search the records without having to leave the original form.

I would like some assistance on how I could set the query to change to the value in a text box on the form.

Many Thanks.

Ben Kowalewicz
 
Are you trying to create a search form? or wanting to search on a criteria in a textbox? Try using the useful dlookup command in VBA.

Ian Mayor (UK)
Program Error
There's ALWAYS more than one way to skin a cat!
But only one way to get it RIGHT!
 
I am wanting to search on a criteria in a textbox so that the values in the other text boxes change to match this value
 
If you are using a query to find the results, you need to put the name of the textbox in the criteria of the query field. some thing like....

Like "*" & [Enter name to search for] & "*"

or

Like "*" & [forms]![nameofform].[nameoftextbox] & "*"

numbers are treated differently and require = or <> or > or < or not or NZ() instead of like. It all depends what is in the textbox.
If you are using vba then try...

Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[tablefield] = '" & Me![nameoftextbox] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark



Ian Mayor (UK)
Program Error
There's ALWAYS more than one way to skin a cat!
But only one way to get it RIGHT!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top