[Last Call] Learn how to a build a cloud-first strategyRegister Now


filtering subform using textbox

Posted on 2008-11-04
Medium Priority
Last Modified: 2013-11-28
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.
Question by:luusac
  • 2
  • 2
LVL 13

Accepted Solution

wiswalld earned 375 total points
ID: 22885657
Forms![MainForm]![SubForm].Form.Filter = "(([lastname] LIKE '*" & Me.[txtFilterRecords].Text & "*'))"

LVL 13

Expert Comment

ID: 22885662
Forms![MainForm]![SubForm].Form.Filter = "(([lastname] LIKE '*" & Me.[txtFilterRecords] & "*'))"

Author Comment

ID: 22898622
yes, this did the trick, many thanks

Author Closing Comment

ID: 31513401
many thanks

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question