It would be a good idea for you to read through some threads dealing with error handling in VBA.
This is a link to Allen Browne's page on error handling. I personally use his error logging code.
However, to give you a brief overview:
On line 2 of your code you will have something like this:
Code: ( text )
On Error GoTo Err_Form_BeforeUpdate
At the end of your code block (just before the End Sub) you'll have:
Code: ( text )
Exit_Form_BeforeUpdate:
Exit Sub
Err_Form_BeforeUpdate:
MsgBox Err.Description & " " & Err.Number, vbCritical
Resume Exit_Form_BeforeUpdate
Obviously you can make the MsgBox say anything you want, including setting it's title, etc... There really isn't any need to set the warnings false, since this will suppress the default error message by itself, however, for future information the command to do so is:
Code: ( text )
DoCmd.SetWarnings = False
Don't forget to set them on again before you exit the sub routine:
Code: ( text )
Regards,
Scott