M
mscertified
Here is the code, the first column in the table is the primary key. I get an
Access error window (with a negative error number) instead of the error trap
being triggered. I need to trap duplicate inserts.
Public Sub DupTest()
On Error GoTo ER
Dim strSQL As String
strSQL = "INSERT INTO tblLock (LT,Userid) Values('Q','dcmcspar')"
CurrentProject.Connection.Execute strSQL
CurrentProject.Connection.Execute strSQL
Exit Sub
ER:
MsgBox Err.Description, , Err.Number
End Sub
Access error window (with a negative error number) instead of the error trap
being triggered. I need to trap duplicate inserts.
Public Sub DupTest()
On Error GoTo ER
Dim strSQL As String
strSQL = "INSERT INTO tblLock (LT,Userid) Values('Q','dcmcspar')"
CurrentProject.Connection.Execute strSQL
CurrentProject.Connection.Execute strSQL
Exit Sub
ER:
MsgBox Err.Description, , Err.Number
End Sub