Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Remove required error message (2000)

    Hi,
    Is it possible to remove the standard error message you get when you miss out a required field?
    I'm trying to keep the focus on a specific field within a form which is required, and I wish to put a more user friendly message if IsNull.
    Also I'm trying to stop any other navigation to any other records which seems to bypass this.

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Remove required error message (2000)

    Assuming that data is being entrered via form, you can use the Before Update of the form to perform whatever validation you want to perform on the record, and display whatever messages you like (using Msgbox). If the data does not meet your validation requirements, set Cancel = true , and the user will be forced to stay with the current record.

    You can also set the focus to the control of your choice.
    Regards
    John



  3. #3
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove required error message (2000)

    Sorry, I haven't used the cancel before. Would it literally be:

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    If IsNull(Me.Full) Then
    MsgBox "Please enter a name", vbCritical, "Error"
    Me.Full.SetFocus
    Cancel=False
    End If
    End Sub

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Remove required error message (2000)

    When you want to cancel the update, you set

    Cancel = true

    rather than

    Cancel = false
    Regards
    John



  5. #5
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove required error message (2000)

    Many thanks!!!!

Posting Permissions

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