(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.
|