I am new to writing VBA and am stuggling to understand why my ElseIf statement is failing to complie.
The combo box is unbound and pulls data from a lookup table. I put a "0. All" record in the table so the user could select it to retrieve all records after a filter. Right now, once the records are filtered I can't get back to an unfiltered state. I can't find anything on VBA syntax to refer to for why ElseIF has errors.
Private Sub CboTeam_AfterUpdate()
If IsNull(Me.CboTeam) Then
Me.FilterOn = False
ElseIf Me.CboTeam = "0. All"
Me.FilterOn = False
Else
Me.Filter = "Team = """ & Me.CboTeam & """"
Me.FilterOn = True
End If
End Sub
The combo box is unbound and pulls data from a lookup table. I put a "0. All" record in the table so the user could select it to retrieve all records after a filter. Right now, once the records are filtered I can't get back to an unfiltered state. I can't find anything on VBA syntax to refer to for why ElseIF has errors.
Private Sub CboTeam_AfterUpdate()
If IsNull(Me.CboTeam) Then
Me.FilterOn = False
ElseIf Me.CboTeam = "0. All"
Me.FilterOn = False
Else
Me.Filter = "Team = """ & Me.CboTeam & """"
Me.FilterOn = True
End If
End Sub