[AccessD] filtering a subform

Stuart McLachlan stuart at lexacorp.com.pg
Thu Sep 22 16:10:52 CDT 2005


On 22 Sep 2005 at 9:40, Charlotte Foust wrote:

> You can't alter the subform's recordsource *after it opens*, which I
> don't find odd, given the nature and intent of subforms.  

I can.  I just tried this and it works perfectly (A2K).
Two Tables, Table1 and Table 2 with identical structure.
Two Forms, Form1 is a subform of Form2 and Form2 also contains a button.

The following code switches display between the two recordsources in the 
subform every time I click on the button on Form2

Private Sub Command9_Click()
If Forms!form2!Form1.Form.RecordSource = "Table1" Then
 Forms!form2!Form1.Form.RecordSource = "Table2"
Else
  Forms!form2!Form1.Form.RecordSource = "Table1"
End If
-- 
Stuart





More information about the AccessD mailing list