Indexed field - modify error message

T

Tom

I got answer in a different thread...

here's the function:




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

'This is a quick way to display the error number can trap
it.
'Uncomment the next line to display the error number.
'MsgBox DataErr

'Once the error number has been identified, you can
delete or
'comment out the Msgbox line of code above.


'Now, plug in the error number (e.g. 3022) in next line.

If DataErr = 3022 Then
MsgBox "Duplicate UniqueID - please enter unique
value!"
Response = acDataErrContinue
Me!UniqueID = Null

'The Null line of code is just a convenience, so the user
'can just start typing again immediately after closing the
'message box.
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