Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested Select Case statements 1

Status
Not open for further replies.

jwigal

Programmer
Mar 16, 2001
31
US
I am trying to get this to run as an error handling procedure, and for the life of me, I can't see what the problem is.

The docs clearly state that I can nest 'select case' statements but I am getting an error message that says that stops on the second-to-last End Select statement, saying that I can't have an 'End Select' without a 'Select Case'

Here's my code:
Code:
Err_Handler:

    Select Case Err
        Case -2147217887
            'The changes you requested to the table were not successful
            'because they would create duplicate values in the index,
            'primary key, or relationship.  Change the data in the field
            'or fields that contain duplicate data, remove the index, or
            'redefine the index to permit duplicate entries and try again.
            'stop point: Stop Point: Insert New Referees ->Old Ref ID: 150
            
            If Left(strLastCommand, 19) = "Insert New Referees" Then
                If SupressDupeMsgs Then
                    strWhatWasImported = strWhatWasImported & _
                        "--> Duplicate referee skipped: " & rstOld![Name] & " (" & rstOld!ID _
                        & ")"
                    rstNew.CancelUpdate
                    Resume Next
                End If
                
                Select Case MsgBox("Referee Assistant has found a duplicate referee name in your incoming GameData file.  Duplicate values were permitted with the old version of Referee " _
                    & "Assistant, but are not permitted with the Professional Edition.  " & vbNewLine & vbNewLine _
                    & "A list of duplicates will be provided at the end of the import process.  " & vbNewLine & vbNewLine _
                    & "Do you want to see this message for each duplicate referee found?" & vbNewLine & vbNewLine _
                    & "-> Click YES to continue the import and see this warning message for each duplicate referee found" & vbNewLine _
                    & "-> Click NO to continue the import and supress these messages" & vbNewLine _
                    & "-> Click CANCEL to stop the import process and roll back all changes to Referee Assistant Pro.", _
                    vbExclamation + vbYesNoCancel)
                Case vbYes
                    strWhatWasImported = strWhatWasImported & _
                        "--> Duplicate referee skipped: " & rstOld![Name] & " (" & rstOld!ID _
                         & ")"
                    rstNew.CancelUpdate
                    Resume Next
                Case vbNo
                    SupressDupeMsgs = True
                    strWhatWasImported = strWhatWasImported & _
                            "--> Duplicate referee skipped: " & rstOld![Name] & " (" & rstOld!ID _
                             & ")"
                    rstNew.CancelUpdate
                    Resume Next
                Case vbCancel
                    rstNew.Cancel
                    GoTo Exit_Nicely
                End Select
        Case Else
            MsgBox "do this"
        

    End Select

Any thoughts?

----------
Jeff Wigal
jeff@wigaldesign.com
Referee Assistant for MS Access
 
It's probably relating to the missing End If that should've been placed betwenn the first End Select and the Case Else, if I read it correctly.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top