I have a form by Primary Companies and a subform with the many locations of the Primary Company. These locations are by state. I added a unbound combo box that is using a state table. I would like the user to select the state and then filter the subform based on the state selected. If the company does not have a location in the state then it does a message pops up "State Not Found". If there is a match then Filter the subform and message "Filter Applied" I can't get the else to work. It only executes the first if.
Private Sub cboState_Click()
Dim scboState
Dim sState
scboState = Me.cboState
sState = Me.State
If scboState <> sState Then
FilterOn = False
MsgBox "State Not Found"
Me.cboState.value = ""
ElseIf scboState = sState Then
Filter = "sState =" & scboState
FilterOn = True
MsgBox "Filter Applied"
End If
End Sub
Private Sub cboState_Click()
Dim scboState
Dim sState
scboState = Me.cboState
sState = Me.State
If scboState <> sState Then
FilterOn = False
MsgBox "State Not Found"
Me.cboState.value = ""
ElseIf scboState = sState Then
Filter = "sState =" & scboState
FilterOn = True
MsgBox "Filter Applied"
End If
End Sub