Customer Error Message

  • Thread starter Thread starter Raj
  • Start date Start date
R

Raj

I have a database that I have convert to a SQL Server 7.0
backend. I have the OnError on my main for set to:
If DataErr = 3022 Then
MsgBox "Sorry, This item is already exists in the
Database."
Response = acDataErrContinue
End If
How can I customize SQL to show the same message..
Thanks
 
I have a database that I have convert to a SQL Server 7.0
backend. I have the OnError on my main for set to:
If DataErr = 3022 Then
MsgBox "Sorry, This item is already exists in the
Database."
Response = acDataErrContinue
End If
How can I customize SQL to show the same message..
Thanks

You pretty much have to create a view of your table, include WITH VIEW
METADATA so that Access doesn't try to write to the table directly, then
create a trigger on the view for instead of Insert/Update, and have it
pre-check if there is a duplicate, and roll back the transaction, and raise
the custom error message using RAISERROR('<my message>',16,1).
 
Back
Top