Re: Substituting a more user friendly error message

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Roger Carlson (NO-Rog3erc-SPAM_at_hotmail.com)
Date: 11/08/04


Date: Mon, 8 Nov 2004 09:40:37 -0500

You can do this in the On Error event of the FORM. Put something like the
following in the event:

'-----------------------------
Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 2279 Then '**not formatted for input mask**
    MsgBox "The number is not formatted properly"
ElseIf DataErr = 2213 Then '**not a real date**
    MsgBox "The number is not a real date"
Else
    MsgBox DataErr
End If
Response = acDataErrContinue
End Sub
'-----------------------------

You can trap any number of form level errors here.

-- 
--Roger Carlson
  Access Database Samples: www.rogersaccesslibrary.com
  Want answers to your Access questions in your Email?
  Free subscription:
  http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
"John S. Ford, MD" <johnsfordNOSPAMmd@hotmail.com> wrote in message
news:e0JyQOWxEHA.1524@TK2MSFTNGP09.phx.gbl...
> I'm using Access 97.
>
> I have an entry form that requires users to input several dates in some
> TextBoxes.  If the user enters data not in an acceptable date format, an
> Access error message pops up that is not very user friendly.  Is there a
way
> I can substitute my own (hopefully kinder, gentler message) for the
standard
> message?
>
> Does this action by my user trigger an Error Event that I can capture and
> write my own error handler?  If so how?
>
> John
>
>


Relevant Pages

  • Re: Unfriendly error message in date field
    ... Use the form's Error event. ... Private Sub Form_Error(DataErr As Integer, Response As Integer) ... > cannot get in front of that error message. ...
    (microsoft.public.access.formscoding)
  • Re: On Error MsgBox Not Wanted
    ... Teach the user to press Esc key to undo the entry if they want out. ... it should be limited ot DataErr 3314. ... > Private Sub Form_Error(DataErr As Integer, Response As Integer) ...
    (microsoft.public.access.forms)
  • Re: Using Form_Error to trap Data Errors
    ... I'm not sure there is a list of the DataErr values. ... The Response argument is provided so you can set it to tell Access how to ... > reason. ... > Private Sub Form_Error ...
    (microsoft.public.access.formscoding)
  • Re: Simple error message for duplicate records
    ... That DataErr code is just what I was looking for. ... Private Sub Form_Error(DataErr As Integer, Response As Integer) ...
    (microsoft.public.access.forms)
  • Re: On Error MsgBox Not Wanted
    ... If DataErr = 3314 Then ... >> OnError property to =CantBeBlank, because you can only pass the DataErr ... >>> Private Sub Form_Error(DataErr As Integer, Response As Integer) ...
    (microsoft.public.access.forms)