vbams-accessms-access-2007exit-codeselect-case

Exit Select Case - VBA MsAccess


I need to exit the select case in vba ms access but I cant figure how to do it, this is a screen shot of the error I get.

enter image description here


Solution

  • If this won't work...

    Select Case Cat
        Case 1
            If (Condition1 Or Condition2 Or Condition3) Then
                Exit Select  ' <- Compile error
            End If
    
            ' do stuff
    

    ...then why not just do this instead?

    Select Case Cat
        Case 1
            If Not (Condition1 Or Condition2 Or Condition3) Then
    
                ' do stuff
    
            End If