T
tina
one option is to add a procedure to the form's OnError-----Original Message-----
I have a form that may be closed without the primary
index value being entered. When this happens an error
message is displayed. I would like to override that
error message with one of my own. I also want to be able
to close the form without further error messages (also
not save the current record) by having the user to select
<Cancel> on my own Message Box. Can someone help me?
Don Rountree
.
event, as
Private Sub Form_Error(DataErr As Integer, Response As
Integer)
Dim intChoice As Integer
If DataErr = 3058 Then
Response = acDataErrContinue
intChoice = MsgBox("Put your custom message here."
& vbCr & vbCr & "Click OK to add the " _
& "missing information." & vbCr & "Click
Cancel to close the window without saving the " _
& "record.", vbOKCancel + vbDefaultButton2)
If intChoice = vbCancel Then
Me.Undo
DoCmd.Close , , acSaveNo
End If
End If
End Sub
fyi, you can initially trap form (record) errors here too,
so you can identify the error number, as
Private Sub Form_Error(DataErr As Integer, Response As
Integer)
MsgBox DataErr
End Sub