Re: Modify the Default Error Msg
- From: "Jeanette Cunningham" <nnn@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 20 Feb 2008 08:10:33 +1100
Tom,
this code has a syntax problem on the 2nd line
Private Sub Form_Error(DataErr As Integer, Response As Integer)
If Me.CASELOAD.Text = Not Null Then
MsgBox "A caseload type must be entered in order to continue.", vbCritical,
"CASELOAD Error Message"
Exit Sub
End If
End Sub
This line
If Me.CASELOAD.Text = Not Null Then
rewrite like this
If Not IsNull(Me.CASELOAD) Then
Jeanette Cunningham
"TomP" <TomP@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:203A13F2-FE77-4BFE-9B9A-331D79F5FDB6@xxxxxxxxxxxxxxxx
The argument from the Form_Error works. But, I don't understand why it
doesn't work when I use the command button. I copied/paste the text from
the
form_error and added to the Add New Record button and this is the error I
get
"You can't go to the specirfied record."
Private Sub Command182_Click()
Const conErrRequiredData = 3314
If DataErr = conErrRequiredData Then
MsgBox "Please ensure that you enter a caseload type before you
continue!", vbCritical, "Caseload Type Error Message"
Response = acDataErrContinue
Else
'Display a standard error message
Response = acDataErrDisplay
End If
On Error GoTo Err_Command182_Click
DoCmd.GoToRecord , , acNewRec
Exit_Command182_Click:
Exit Sub
Err_Command182_Click:
MsgBox Err.Description
Resume Exit_Command182_Click
End Sub
Thank you for your help!
Tom
"Allen Browne" wrote:
In Form_Error, include the MsgBox for the message you want.
Then set the Response argument to suppress the built-in message.
On-line help for the Error event (in the Code window) will give details.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"TomP" <TomP@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:094BA623-B7AF-4B97-8B3D-06584679821A@xxxxxxxxxxxxxxxx
I tried the script as shown below and for some reason I get the same
default
error message. I even tried the code as shown below to display the
actual
error number and nothing happens.
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Debug.Print "DataErr = "; DataErr
End Sub
.
- References:
- Re: Modify the Default Error Msg
- From: Allen Browne
- Re: Modify the Default Error Msg
- From: TomP
- Re: Modify the Default Error Msg
- From: Allen Browne
- Re: Modify the Default Error Msg
- From: TomP
- Re: Modify the Default Error Msg
- From: Linq Adams via AccessMonster.com
- Re: Modify the Default Error Msg
- From: Allen Browne
- Re: Modify the Default Error Msg
- From: TomP
- Re: Modify the Default Error Msg
- Prev by Date: Re: Update subform query
- Next by Date: RE: Can my form fill in a field, yet allow me to override?
- Previous by thread: Re: Modify the Default Error Msg
- Next by thread: Re: I am using a tree control (MSComctlLib.TreeCtrl.2) in a form...
- Index(es):
Relevant Pages
|