A
Ann in CA
Hello,
I have a form with 5 subforms all based on different tables. There is a
toggle at the top of the form to "Apply group filter" where I would like all
5 subforms to filter out records whose discipline is not equal to the user's
discipline (stored in glDiscipline). The filter applies fine to all five
subforms, but when I click the button again to remove the filter, it only
removes it from the first subform in the If toggle51 = 0 event list
(currently, frmMainFormSubE in the code below, but if I change the order, it
will remove from any other).
So how would I go about getting the filter removed from all five subforms at
once?
Here is the code:
Private Sub Toggle51_Click()
On Error GoTo Proc_Error
If Me.Toggle51 = -1 Then
Me.frmMainFormSubA.Form.Filter = "[Discipline] = '" & glDiscipline & "'"
Me.frmMainFormSubA.Form.FilterOn = True
Me.frmMainFormSubB.Form.Filter = "[Discipline] = '" & glDiscipline & "'"
Me.frmMainFormSubB.Form.FilterOn = True
Me.frmMainFormSubC.Form.Filter = "[Discipline] = '" & glDiscipline & "'"
Me.frmMainFormSubC.Form.FilterOn = True
Me.frmMainFormSubD.Form.Filter = "[Discipline] = '" & glDiscipline & "'"
Me.frmMainFormSubD.Form.FilterOn = True
Me.frmMainFormSubE.Form.Filter = "[Discipline] = '" & glDiscipline & "'"
Me.frmMainFormSubE.Form.FilterOn = True
End If
If Me.Toggle51 = 0 Then
Me.frmMainFormSubE.Form.FilterOn = False
Me.frmMainFormSubA.Form.FilterOn = False
Me.frmMainFormSubB.Form.FilterOn = False
Me.frmMainFormSubC.Form.FilterOn = False
Me.frmMainFormSubD.Form.FilterOn = False
Me.FilterOn = False
End If
Proc_Exit:
Exit Sub
Proc_Error:
MsgBox Err.Number & Err.Description
End Sub
TIA!
I have a form with 5 subforms all based on different tables. There is a
toggle at the top of the form to "Apply group filter" where I would like all
5 subforms to filter out records whose discipline is not equal to the user's
discipline (stored in glDiscipline). The filter applies fine to all five
subforms, but when I click the button again to remove the filter, it only
removes it from the first subform in the If toggle51 = 0 event list
(currently, frmMainFormSubE in the code below, but if I change the order, it
will remove from any other).
So how would I go about getting the filter removed from all five subforms at
once?
Here is the code:
Private Sub Toggle51_Click()
On Error GoTo Proc_Error
If Me.Toggle51 = -1 Then
Me.frmMainFormSubA.Form.Filter = "[Discipline] = '" & glDiscipline & "'"
Me.frmMainFormSubA.Form.FilterOn = True
Me.frmMainFormSubB.Form.Filter = "[Discipline] = '" & glDiscipline & "'"
Me.frmMainFormSubB.Form.FilterOn = True
Me.frmMainFormSubC.Form.Filter = "[Discipline] = '" & glDiscipline & "'"
Me.frmMainFormSubC.Form.FilterOn = True
Me.frmMainFormSubD.Form.Filter = "[Discipline] = '" & glDiscipline & "'"
Me.frmMainFormSubD.Form.FilterOn = True
Me.frmMainFormSubE.Form.Filter = "[Discipline] = '" & glDiscipline & "'"
Me.frmMainFormSubE.Form.FilterOn = True
End If
If Me.Toggle51 = 0 Then
Me.frmMainFormSubE.Form.FilterOn = False
Me.frmMainFormSubA.Form.FilterOn = False
Me.frmMainFormSubB.Form.FilterOn = False
Me.frmMainFormSubC.Form.FilterOn = False
Me.frmMainFormSubD.Form.FilterOn = False
Me.FilterOn = False
End If
Proc_Exit:
Exit Sub
Proc_Error:
MsgBox Err.Number & Err.Description
End Sub
TIA!