• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 576
  • Last Modified:

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
0
luusac
Asked:
luusac
  • 2
  • 2
1 Solution
 
wiswalldCommented:
Forms![MainForm]![SubForm].Form.Filter = "(([lastname] LIKE '*" & Me.[txtFilterRecords].Text & "*'))"

0
 
wiswalldCommented:
Forms![MainForm]![SubForm].Form.Filter = "(([lastname] LIKE '*" & Me.[txtFilterRecords] & "*'))"
0
 
luusacAuthor Commented:
yes, this did the trick, many thanks
0
 
luusacAuthor Commented:
many thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now