View Full Version : part of criteria taken from text box from a form


ivanteo
05-03-2002, 01:14 AM
i have a field in a query that has numbers and text (ie 00129-BGT-456, BGT-43997-029)and i would like to query all records with the text BGT in them. But this input, BGT, will be keyed in a form and the query gets the criteria from there. Does anyone know how to do this?
When i key Like "*BGT*" in the criteria of my field, i am able to get all the data with BGT in them but i just can't seem to get it to work with the form.
thank you in advance!

Fizzio
05-03-2002, 03:20 AM
In the Query that supplies the form, with an unbound textbox eg txtSearchBox, set the criteria for the field you want to query and in the criteria just put like "*" & Forms![NameofForm]![txtSearchBox] & "*". It will then replace Forms![NameofForm]![txtSearchBox] with whatever you type eg BGT.

Set the After_Update of the search box to me.requery to refresh the form data.

HTH

ivanteo
05-05-2002, 10:57 PM
Thank you so much!
it works really well now! http://www.access-programmers.co.uk/ubb/smile.gif