Validating using BeforeUpdate

  • Thread starter Lee Stafford via AccessMonster.com
  • Start date
L

Lee Stafford via AccessMonster.com

I had looked over previous threads and found one that works for me, except
I get my message and one that Access generates.

"The value in the field violates a validation rule for the record or
field." "For example you may have changed a validation rule without
verifying whether the existing data matches the new validation rule."

It only displays it the first time that the incorrect number is entered. I
guess I could live with it, but is there a way that I could have one or the
other? Here is my code. Tia, Lee

Private Sub WONumber_BeforeUpdate(Cancel As Integer)
If DLookup("WONUMBER", "TBL_QA_WO_INFO", "WONUMBER=[forms]!
[FRM_QaFieldEntryForm].[WONumber]") = WONumber Then
MsgBox "Duplicate Work Order Number" & vbCrLf & "Check your number and
try again"
Cancel = True
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top