Combo Box Value in ElseIf Statement

jdbegg

New member
Local time
Today, 10:17
Joined
Mar 13, 2003
Messages
24
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
 
You need to add the keyword then after your condition of your else if statement.
 
The ElseIf line needs a "Then".
 
Last edited:
Thanks

Thanks all, that was an easy one to solve :D
 

Users who are viewing this thread

Back
Top Bottom