Link to home
Start Free TrialLog in
Avatar of luusac
luusac

asked on

filtering subform using textbox

I have a main/subform in an Access 2007 db and am using
Forms![MainForm]![SubForm].Form.FilterOn = False
Forms![MainForm]![SubForm].Form.Filter = "[FieldtoFilter] = '" & Me.[txtFilterRecords].Text & "'"
Forms![MainForm]![SubForm].Form.FilterOn = True
to filter the subform via the textbox onChange event.  However, this only displays a record if there is an exact match, e.g. to display the record with "Hello World" in the FieldtoFilter I have to enter the whole "Hello World", I can't just put in "Hello" and have the filter display the matching record(s) (where matching would mean that the field either contains "Hello" (best solution) or begins with "Hello").  I prefer to do this via a filter rather than a new query.
thanks
lu
ASKER CERTIFIED SOLUTION
Avatar of wiswalld
wiswalld
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forms![MainForm]![SubForm].Form.Filter = "(([lastname] LIKE '*" & Me.[txtFilterRecords] & "*'))"
Avatar of luusac
luusac

ASKER

yes, this did the trick, many thanks
Avatar of luusac

ASKER

many thanks