I use this code to trap a duplicate entry on a form. I realise I could simply copy and paste this to all the other forms and amend the message box. Am I right in thinking that I could put this into a module and then call it from the various forms or am I way off track here. If I could any suggestions on how to construct the code.
Const RecordAlreadyExists = 3022
If dataerr = RecordAlreadyExists Then
MsgBox "You have already inserted that training course." & vbCrLf _
& " Please try again.", vbCritical
Response = acDataErrAdded
Me.Undo
End If
End Sub
Const RecordAlreadyExists = 3022
If dataerr = RecordAlreadyExists Then
MsgBox "You have already inserted that training course." & vbCrLf _
& " Please try again.", vbCritical
Response = acDataErrAdded
Me.Undo
End If
End Sub