Home  |   French  |   About  |   Search  | mvps.org  

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

In Memoriam

Terms of Use


VB Petition

Forms: Cannot ApplyFilter on SubForm

Author(s)
Dev Ashish

(Q)    I'm trying to restrict the records displayed in a subform by using ApplyFilter on it, but it doesn't work.  What's the right way to do it?

(A)    The proper way is to change the Recordsource of the subform itself.  Using ApplyFilter on the subform will change the main form itself. 

        So either generate the SQL statement dynamically and assign that to the Recordsource of the subform using a syntax like

strSQL="Select * from sometable where"
strSQL=strSQL & " someID=" & me!IDonMainForm
Me!SubFormName.Form.RecordSource=strSQL

or use predefined queries and swap the assigned names using the same syntax as described above.


© 1998-2010, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer