Suppress record update error message

Posted on 2005-04-26
Last Modified: 2010-08-05
I have a very simple table of usernames, passwords, and a few other fields.
I have a continuous form based on this table.
In the Before update event of the password field, I check for minimum length, maximum length, and non alphanumeric characters. If the password doesn't meet the criteria then I let the user know and then cancel the event.
    Msgbox "Invalid Password...etc."
    Cancel = True

Unfortuanately, after my message box is closed, Access pops up its own message box about "The value in the field or record violates the validation rule for the record or field"

How can I suppress this message so that the user can just correct the password field and continue on. It seems like it should be simple, but its driving me nuts.
Question by:Mach1pro
    LVL 1

    Accepted Solution

    Put this in the forms module:

    Private Sub Form_Error(DataErr As Integer, Response As Integer)

        Response = 0
    End Sub

    ...Good Luck
    LVL 16

    Expert Comment

    In the BeforeUpdate event enter:


    LVL 5

    Expert Comment

    DoCmd.SetWarnings False  'turn off messages

    ....Your code here

    DoCmd.SetWarnings True  'turn on messages
    LVL 6

    Author Comment

    Please see  Q_21404242.html

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    In the previous article, Using a Critera Form to Filter Records (, the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
    Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
    In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now