Form Filter

  • Thread starter Thread starter Shelly
  • Start date Start date
S

Shelly

I have an unbound textbox and a command button. I've got
code that will filter my subform based on what is entered
in the unbound text box. I have this working when it
matches the full field. What I need is to modify the
Name filter to use wildcards. My users need to be able
to enter a portion of a hospital name and get anything
that has that in it. For example, the type in Community
and get all the hospitals that have Community in the
hospital name.

Here's the code I have working for all the other filters.

Form.Filter = "[HospitalName] Like 'Forms![GPO
Listings]!AmerinetList.Form![NameFilter]'"

Form.FilterOn = True

I've tried all sorts of versions using wildcards in the
code and in the user entered text. I've got to be doing
somthing stupid for this not to work. Any help would be
appreciated.

Shelly
 
Try:

Form.Filter = "[HospitalName] Like '*" & _
Forms![GPO Listings]!AmerinetList.Form![NameFilter] & "*'"
Form.FilterOn = True
 
Back
Top