[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

Suppress record update error message

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.
1 Solution
Put this in the forms module:

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

    Response = 0
End Sub

...Good Luck
In the BeforeUpdate event enter:


DoCmd.SetWarnings False  'turn off messages

....Your code here

DoCmd.SetWarnings True  'turn on messages
Mach1proAuthor Commented:
Please see  Q_21404242.html

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now