Search condition

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all... I would like to know if there is a condition that would allow me to
do search on any part of a field. This link shows how to search a particular
field but has to be an exact match. I want it to be able to search for any
part of a field. How could this be written? Please help. Thanx
conditionwz5.png
 
Well i hope this is what you want to do,

A txtbox called Txtfind on your form
Type in what you want to find
BLAM, Up pops the records your seacrching for. WOW

i.e Search for a last name containing 'Zap'
Type in 'Zap' in your txtFind txtbox
And people who have 'zap' in their lastname pop up

Whatyazapper
jackzapson
etc

Private Sub txtfind_AfterUpdate()

If Me.Dirty Then 'Save first
Me.Dirty = False
End If

If IsNull(Me.txtFind) Then 'Show all
Me.FilterOn = False
Else
'--FieldToSearchON Could be something like LastName or FirstName or
Whatever
Me.Filter = "[FieldToSearchON] Like ""*" & Me.txtFind & "*"""
Me.FilterOn = True
End If

End Sub

Have Fun & hope this helps
Hi all... I would like to know if there is a condition that would allow me to
do search on any part of a field. This link shows how to search a particular
field but has to be an exact match. I want it to be able to search for any
part of a field. How could this be written? Please help. Thanx
conditionwz5.png
 
Hi all... I would like to know if there is a condition that would allow me to
do search on any part of a field. This link shows how to search a particular
field but has to be an exact match. I want it to be able to search for any
part of a field. How could this be written? Please help. Thanx
conditionwz5.png

Rather than

[Music] = [Enter song title:]

use

[Music] LIKE "*" & [Enter song title:] & "*"

John W. Vinson [MVP]
 
Thank you so much you are a genius... It worked...

John W. Vinson said:
Hi all... I would like to know if there is a condition that would allow me to
do search on any part of a field. This link shows how to search a particular
field but has to be an exact match. I want it to be able to search for any
part of a field. How could this be written? Please help. Thanx
conditionwz5.png

Rather than

[Music] = [Enter song title:]

use

[Music] LIKE "*" & [Enter song title:] & "*"

John W. Vinson [MVP]
 

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

Back
Top