Hi,
I have an option group with four toggle buttons on my main form. I'm using them to filter the subform records. I'm sure there is a way to condense the code but I think it works fine. However when I click into the subform to scroll the records the LostFocus clears the applied filter. Any suggestions? I need the last toggle button pushed to keep the focus even when clicking outside of the option group.
tglAllRecords - no code, default toggle button
Private Sub tglCompleted_GotFocus()
Dim subfrm As Access.Form
Dim strFilter As String
Set subfrm = Me.frmLianzi_MDR_Form_Updates.Form
subfrm.Filter = "Progress = 100"
subfrm.FilterOn = True
End Sub
Private Sub tglCompleted_LostFocus()
Dim subfrm As Access.Form
Dim strFilter As String
Set subfrm = Me.frmLianzi_MDR_Form_Updates.Form
subfrm.Filter = "Progress = 100"
subfrm.FilterOn = False
End Sub
Private Sub tglInProcess_GotFocus()
Dim subfrm As Access.Form
Dim strFilter As String
Set subfrm = Me.frmLianzi_MDR_Form_Updates.Form
subfrm.Filter = "Progress < 100 OR Progress IS NULL"
subfrm.FilterOn = True
End Sub
Private Sub tglInProcess_LostFocus()
Dim subfrm As Access.Form
Dim strFilter As String
Set subfrm = Me.frmLianzi_MDR_Form_Updates.Form
subfrm.Filter = "Progress < 100 OR Progress IS NULL"
subfrm.FilterOn = False
End Sub
Private Sub tglNotStarted_GotFocus()
Dim subfrm As Access.Form
Dim strFilter As String
Set subfrm = Me.frmLianzi_MDR_Form_Updates.Form
subfrm.Filter = "[A-START] IS NULL"
subfrm.FilterOn = True
End Sub
Private Sub tglNotStarted_LostFocus()
Dim subfrm As Access.Form
Dim strFilter As String
Set subfrm = Me.frmLianzi_MDR_Form_Updates.Form
subfrm.Filter = "[A-START] IS NULL"
subfrm.FilterOn = False
End Sub
TYIA,
Patty
I have an option group with four toggle buttons on my main form. I'm using them to filter the subform records. I'm sure there is a way to condense the code but I think it works fine. However when I click into the subform to scroll the records the LostFocus clears the applied filter. Any suggestions? I need the last toggle button pushed to keep the focus even when clicking outside of the option group.
tglAllRecords - no code, default toggle button
Private Sub tglCompleted_GotFocus()
Dim subfrm As Access.Form
Dim strFilter As String
Set subfrm = Me.frmLianzi_MDR_Form_Updates.Form
subfrm.Filter = "Progress = 100"
subfrm.FilterOn = True
End Sub
Private Sub tglCompleted_LostFocus()
Dim subfrm As Access.Form
Dim strFilter As String
Set subfrm = Me.frmLianzi_MDR_Form_Updates.Form
subfrm.Filter = "Progress = 100"
subfrm.FilterOn = False
End Sub
Private Sub tglInProcess_GotFocus()
Dim subfrm As Access.Form
Dim strFilter As String
Set subfrm = Me.frmLianzi_MDR_Form_Updates.Form
subfrm.Filter = "Progress < 100 OR Progress IS NULL"
subfrm.FilterOn = True
End Sub
Private Sub tglInProcess_LostFocus()
Dim subfrm As Access.Form
Dim strFilter As String
Set subfrm = Me.frmLianzi_MDR_Form_Updates.Form
subfrm.Filter = "Progress < 100 OR Progress IS NULL"
subfrm.FilterOn = False
End Sub
Private Sub tglNotStarted_GotFocus()
Dim subfrm As Access.Form
Dim strFilter As String
Set subfrm = Me.frmLianzi_MDR_Form_Updates.Form
subfrm.Filter = "[A-START] IS NULL"
subfrm.FilterOn = True
End Sub
Private Sub tglNotStarted_LostFocus()
Dim subfrm As Access.Form
Dim strFilter As String
Set subfrm = Me.frmLianzi_MDR_Form_Updates.Form
subfrm.Filter = "[A-START] IS NULL"
subfrm.FilterOn = False
End Sub
TYIA,
Patty