I have an unbounded Form Called [frmTestsMain] which includes 3 subforms:
- [frmTestsList]
- [frmTMGroupList]
- [frmTSGroupList]
- [frmTMGroup] has a filed "TMGroup",
- [frmTSGroup] has a filed called "TSGroup" and another lookup filed "TMGroup" linked to [frmTMGroup].TMGroup.
- [frmTestsList] has lookup filed "TSGroup" linked to [frmTSGroup].TSGroup.
What I want is:
- When I click [frmTMGroup].TMGroup, the other subform [frmTSGroup] to be filtered to get only TMGroup clicked.
- When I click [frmTSGroup].TSGroup, the other subform [frmTestsList] to be filtered to get only TSGroup clicked.
I wrote the code like below and worked with no problems If I open the [frmTestsMain] directly.
Private Sub TestMGroup_Click()
Forms![frmTestsMain]![frmTSGroupList].Form.Filter = "TestMGroup =" & Me.ID
Forms![frmTestsMain]![frmTSGroupList].Form.FilterOn = True
End Sub
and
Private Sub TestSGroup_Click()
Forms![frmTestsMain]![frmTestsList].Form.Filter = "TestSGroup =" & Me.ID
Forms![frmTestsMain]![frmTestsList].Form.FilterOn = True
End Sub
But when I included the [frmTestsMain] from in A navigation form with a min from , i get an error.
I tried to modify the code like the following but I get the same problem
Private Sub TestMGroup_Click()
Forms![frmMain]![NaviTests]![frmTestsMain]![frmTSGroupList].Form.Filter = "TestMGroup =" & Me.ID
Forms![frmMain]![NaviTests]![frmTestsMain]![frmTSGroupList].Form.FilterOn = True
End Sub
Could you help me please. Thanks
TestMGroup
a number or a string? If it's a string you have to surroundMe.ID
with quotes.Filter = "TestMGroup = '" & Me.ID & "'"
- BitAccesser