Hi - Was wondering if anybody could tell me why this rather crappy code is giving me an 'Else without If' error on compile?
All the Elses and Ifs look ok to me but there's a few.
All the Elses and Ifs look ok to me but there's a few.
Code:
Private Sub MySearchButtonClick()
If gcfHandleErrors Then On Error GoTo PROC_ERR
PushCallStack "MySearchButton"
If Me.AllowFlexibility = True Then
If Me.UseSpecialism = True And Me.UseCountryExperience = True Then
If Me.Active = True Then
DoCmd.OpenQuery "Qry_amin5WithBothactive"
Else
DoCmd.OpenQuery "Qry_amin5WithBoth"
End If
Else
If Me.UseSpecialism = True And Me.UseCountryExperience = False Then
If Me.Active = True Then
DoCmd.OpenQuery "Qry_amin5WithSpecialismsactive"
Else
DoCmd.OpenQuery "Qry_amin5WithSpecialisms"
End If
Else
If Me.UseSpecialism = False And Me.UseCountryExperience = True Then
If Me.Active = True Then
DoCmd.OpenQuery "Qry_amin5WithCountryExpactive"
Else
DoCmd.OpenQuery "Qry_amin5WithCountryExp"
End If
Else
If Me.UseSpecialism = False And Me.UseCountryExperience = False Then
If Me.Active = True Then
DoCmd.OpenQuery "Qry_amin5JoinEliminateSearchactive"
Else
DoCmd.OpenQuery "Qry_amin5JoinEliminateSearch"
End If
End If
Else
If Me.UseSpecialism = True And Me.UseCountryExperience = True Then
If Me.Active = True Then
DoCmd.OpenQuery "Qry_WithBothactive"
Else
DoCmd.OpenQuery "Qry_WithBoth"
End If
Else
If Me.UseSpecialism = True And Me.UseCountryExperience = False Then
If Me.Active = True Then
DoCmd.OpenQuery "Qry_WithSpecialismsactive"
Else
DoCmd.OpenQuery "Qry_WithSpecialisms"
End If
Else
If Me.UseSpecialism = False And Me.UseCountryExperience = True Then
If Me.Active = True Then
DoCmd.OpenQuery "Qry_WithCountryExpactive"
Else
DoCmd.OpenQuery "Qry_WithCountryExp"
End If
Else
If Me.UseSpecialism = False And Me.UseCountryExperience = False Then
If Me.Active = True Then
DoCmd.OpenQuery "Qry_JoinEliminateSearchactive"
Else
DoCmd.OpenQuery "Qry_JoinEliminateSearch"
End If
End If
PROC_EXIT:
PopCallStack
Exit Sub
PROC_ERR:
GlobalErrHandler
Resume PROC_EXIT
End Sub
Comment