Change code to search from"first part of field " to "any part of field"

M

mrmajix

I have a form (InventorySearch) with a text box (txtEntry) which requeries
the subform (InventorySearchSubform) on change. The search expression is
linked to the field (Description). How can I change this code to search "any
part of the field" instead of the "first part of field". Thanks in advance.

Private Sub txtEntry_Change()
Me!txtSearchExpression = Me!txtEntry.Text & "*"
InventorySearchDetail.Requery

Exit_txtEntry_Change:
Exit Sub

Err_txtEntry_Change:
MsgBox Err.Description
Resume Exit_txtEntry_Change
End Sub
 
W

Wayne Morgan

It appears you are using the Like statement in the parameter of the query to filter the
list. Placing a * in the front also should do what you want.

"*" & Me!txtEntry.Text & "*"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top