PDA

View Full Version : Partial Search



J.K.W.Y.
03-16-2006, 08:09 PM
Hi All,

I want to create an inputbox (by query) or using a form (by VBA), which would allow user to enter partial string to search for record and in datasheet view / excel.

e.g. tblCustomer
CustomerID CustomerName Address
1 Alice Smith 12 Queen's Road
2 Jason Smith 15 King's Street

So if user type 'Smith' in the inputbox, both of the above record would show up.

Thank you very much!!

geekgirlau
03-16-2006, 09:22 PM
Apply a filter to your form like this:


Me.Filter = "[CustomerName] Like ""*Smith*"""
Me.FilterOn = True

J.K.W.Y.
03-16-2006, 09:32 PM
Apply a filter to your form like this:


Me.Filter = "[CustomerName] Like ""*Smith*"""
Me.FilterOn = True


:think: Thanks, but...
Smith is just an example, I want it to search whatever user put in the inputbox. That's mean it search any letter or number (partial search), and I wouldn't know what user would put in for searching at all.

Someone please HELP me :banghead:

geekgirlau
03-16-2006, 10:27 PM
Assuming that the user is typing their search criteria into a text box on the form,



Me.Filter = "[CustomerName] Like ""*" & Me.txtSearch & "*"""
Me.FilterOn = True