Avatar of Lambel

asked on 

MSAccess Error Function Runs without an error

I have a procedure that I've built in error coding.  For some reason, the error process runs even when there are no errors.  Why is this?
Private Sub cmdCancel_Click()
    Dim strMessage As String
   On Error GoTo cmdCancel_Click_Error

   Forms!frmReportGenerator.[Report Parameters].SetFocus
Forms!frmReportGenerator.[Report Parameters].Controls.txtSaveAs.SetFocus

   On Error GoTo 0
   Exit Sub


    strMessage = "Error " & Err.number & " (" & Err.Description & ") in procedure cmdCancel_Click of VBA Document Form_frmSubRecipients-Add."
    strMessage = strMessage & " Application will stop processing now." & vbNewLine
    strMessage = strMessage & "Please note or copy this error message and contact application developer for assistance."
    MsgBox strMessage, vbCritical + vbOKOnly, "Error"
End Sub

Open in new window

Microsoft Access

Avatar of undefined
Last Comment
Dale Fye

8/22/2022 - Mon