capogna1
Member
- Local time
- Today, 13:57
- Joined
- Aug 8, 2019
- Messages
- 46
Good morning!
I have this code to personalize my error message pertaining duplicate record:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Const ERR_DUPLICATE_INDEX_VALUE = 3022
Dim strMsg As String
If DataErr = ERR_DUPLICATE_INDEX_VALUE Then
strMsg = "This record cannot be added to the database." & vbCrLf
strMsg = strMsg & "It would create a duplicate record." & vbCrLf & vbCrLf
strMsg = strMsg & "Changes were unsuccessful."
MsgBox "Error Number: " & DataErr & vbCrLf & vbCrLf & strMsg, _
vbCritical + vbOKOnly, "Please search by SSN and add encounter to existing Veteran."
'Set focus to the offending control
Me.Patient_SSN_Entry.SetFocus
Response = acDataErrContinue 'prevent Access from displaying its own error message
Else
Response = acDataErrDisplay 'cause Access to display its own error message
End If
End Sub
I would need a code to clear my fields after the message, the fields are:
so the user can search from the combo box below and not worry about clearing the fields manually.
Thanks in advance.
I have this code to personalize my error message pertaining duplicate record:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Const ERR_DUPLICATE_INDEX_VALUE = 3022
Dim strMsg As String
If DataErr = ERR_DUPLICATE_INDEX_VALUE Then
strMsg = "This record cannot be added to the database." & vbCrLf
strMsg = strMsg & "It would create a duplicate record." & vbCrLf & vbCrLf
strMsg = strMsg & "Changes were unsuccessful."
MsgBox "Error Number: " & DataErr & vbCrLf & vbCrLf & strMsg, _
vbCritical + vbOKOnly, "Please search by SSN and add encounter to existing Veteran."
'Set focus to the offending control
Me.Patient_SSN_Entry.SetFocus
Response = acDataErrContinue 'prevent Access from displaying its own error message
Else
Response = acDataErrDisplay 'cause Access to display its own error message
End If
End Sub
I would need a code to clear my fields after the message, the fields are:
so the user can search from the combo box below and not worry about clearing the fields manually.
Thanks in advance.