David-
That constant should be defined in modGlobals. Did you delete that module?
Option Compare Database 'Use database order for string comparisons
' Common Form_Error codes
Public Const errCancel As Long = 2501 '<=====
Public Const errCancel2 As Long = 2001
Public Const errDuplicate As Long = 3022
Public Const errInvalid As Long = 2113
Public Const errValidation As Long = 2116
Public Const errInputMask As Long = 2279
Public Const errRI As Long = 3200
Public Const errCustomValidate As Long = 3316
Public Const errTableValidate As Long = 3317
Public Const errSearchEnd As Long = 8504
Public Const errSpellCheck As Long = 9536
Public Const errGeneral As Long = 3316
Public Const errPropNotFound As Long = 3270
' Places to put the default class names for BMP and JPG files
Public gstrBMPClass As String, gstrJPGClass As String
' Name of this application
Public Const gstrAppTitle As String = "CSD Contacts"
' Places to save Keyboard options
Public gintEnterField As Integer
Public gintMoveEnter As Integer
Public gintArrowKey As Integer
' Places to save current user info
Public gstrThisUser As String
Public gintDontShowCompanyList As Integer
Public gintDontShowContactList As Integer
Public gintDontShowInvoiceList As Integer
' The version of this code
Public Const gTHISVERSION As Currency = 3#
John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
(Paris, France)
On Mar 8, 2017, at 3:11 AM, david.pratt@outlook.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
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
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: John Viescas <johnv@msn.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
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