find button to look in specific place

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

Guest

Is there a code where i can set the find button that on click it
automatically looks in the Name field and is always set to any part of field?
 
Is there a code where i can set the find button that on click it
automatically looks in the Name field and is always set to any part of field?

Program your own Find button instead!

Use it to set the Form's Filter property:

Me.Filter = "[Name] LIKE *" & Me!txtFindName & "*"
Me.FilterOn = True

where txtFindName is the name of an unbound textbox on your form.

John W. Vinson[MVP]
 
Hi John -
I hate to be dense, but I don't know how/where to enter the code you
suggested.

What I had hoped to do was to insert the good ol' binoculars on my form so
that, say, if I had my cursor in a certain field, I could enter the name...
or number... or whatever.... I was looking for & jump there. A find/replace
button right on the field.
Can you suggest how to do that?

--
Thanks for your time!


John Vinson said:
Is there a code where i can set the find button that on click it
automatically looks in the Name field and is always set to any part of field?

Program your own Find button instead!

Use it to set the Form's Filter property:

Me.Filter = "[Name] LIKE *" & Me!txtFindName & "*"
Me.FilterOn = True

where txtFindName is the name of an unbound textbox on your form.

John W. Vinson[MVP]
 
Hi John -
I hate to be dense, but I don't know how/where to enter the code you
suggested.

In VBA code in the Click event of your new search button.
What I had hoped to do was to insert the good ol' binoculars on my form so
that, say, if I had my cursor in a certain field, I could enter the name...
or number... or whatever.... I was looking for & jump there. A find/replace
button right on the field.
Can you suggest how to do that?

You may want to use the very capable "Query By Form" technique. Click
the Filter by Form icon on the toolbar.

John W. Vinson[MVP]
 
Thanks for that answer - but i think i would prefer to look in the whole form
- the main form (because there are subforms attached) and any part of field
so what do i do - replace the name of the form with name or is thre more
changes i have to make?

Me.Filter = "[Name] LIKE *" & Me!txtFindName & "*"
Me.FilterOn = True


John Vinson said:
Is there a code where i can set the find button that on click it
automatically looks in the Name field and is always set to any part of field?

Program your own Find button instead!

Use it to set the Form's Filter property:

Me.Filter = "[Name] LIKE *" & Me!txtFindName & "*"
Me.FilterOn = True

where txtFindName is the name of an unbound textbox on your form.

John W. Vinson[MVP]
 
Also i forgot to ask, will this code give me the little find menu like the
find button gives where i can do find next etc. Or is it setting a filter
that i have to remove afterwards- i dont want that!
Thanks
 
Back
Top