Selasa, 07 Maret 2017

[MS_AccessPros] Error Management in CONTACTS Database

 

John, I downloaded your CONTACTS database and am trying to use the error management.  It will not compile and gives error message "variable not defined" on errCancel.  What am I doing wrong (this time)?

Private Sub Form_Error(DataErr As Integer, Response As Integer)
    ' Pick options based on the error code - see ErrorTable for a complete list
    Select Case DataErr
        Case errCancel, errCancel2, errPropNotFound ' Cancel - ignore
            Response = acDataErrContinue
        Case errDuplicate  ' Duplicate row - custom error message
            MsgBox "You're trying to add a record that already exists.  " & _
                "Enter a new XXXXX or click Cancel.", vbCritical, gstrAppTitle
            Response = acDataErrContinue
        Case errInvalid, errInputMask
            ' Invalid data - custom error and log
            MsgBox "You have entered an invalid value. ", vbCritical, gstrAppTitle
            ErrorLog Me.Name & "_Error", DataErr, AccessError(DataErr)
            Response = acDataErrContinue
        ' Field validation, Table validation, Custom Validation, End of Search, Spelling Check
        Case errValidation, errTableValidate, errCustomValidate, errSearchEnd, errSpellCheck
            ' Do nothing -- let the standard message display
            ' All validation rules in the tables have custom error messages.
            Response = acDataErrDisplay
        Case Else
            ' Dunno - log and let error display
            ErrorLog Me.Name & "_Error", DataErr, AccessError(DataErr)
            Response = acDataErrDisplay
    End Select
End Sub


__._,_.___

Posted by: david.pratt@outlook.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar