luusac
asked on
filtering subform using textbox
I have a main/subform in an Access 2007 db and am using
Forms![MainForm]![SubForm] .Form.Filt erOn = False
Forms![MainForm]![SubForm] .Form.Filt er = "[FieldtoFilter] = '" & Me.[txtFilterRecords].Text & "'"
Forms![MainForm]![SubForm] .Form.Filt erOn = 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
Forms![MainForm]![SubForm]
Forms![MainForm]![SubForm]
Forms![MainForm]![SubForm]
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Forms![MainForm]![SubForm] .Form.Filt er = "(([lastname] LIKE '*" & Me.[txtFilterRecords] & "*'))"
ASKER
yes, this did the trick, many thanks
ASKER
many thanks