Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Force Fields (2000)

    Good afternoon, I have a number of fields where the property is required. Rather than a system generated message telling users that a field is needed and one that doesn't make a great deal of a sense to them, how can I tailor a meaningful message.

    Thanks Darren.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Force Fields (2000)

    You must handle this in a form. Write an event procedure for the On Error event of the form as a whole:

    Private Sub Form_Error(DataErr As Integer, Response As Integer)
    Select Case DataErr
    Case 3314 ' Required field is empty
    MsgBox "You have left this very important field empty." & _
    vbCrLf & "Please fill it in now.", vbExclamation
    Case Else
    MsgBox "Error " & DataErr & " occurred, with description:" & _
    vbCrLf & AccessError(DataErr), vbExclamation
    End Select
    Response = acDataErrContinue
    End Sub

    The DataErr argument contains the number of the error that occurred; if the user leaves a required field empty, thr error number is 3314.
    The Response argument is acDataErrDisplay by default, i.e. show the standard error message. If you set Response to acDataErrContinue in your procedure, the standard error message is suppressed.
    You can add other Cases if you want to handle other errors yourself.

    Note: an alternative to setting Required to Yes in the table is to set Validation Rule to Is Not Null and to enter your custom error message in Validation Text.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •