I have searched all of the previous postings on this item and tried every one of their suggestions. Here is my problem. I have an Access form where the user enters a row and has a primary key in the table. The error number is 3621. I have tried to set up the following:
Private Sub Form_AfterUpdate()
On Error GoTo Err_AfterUpdate
Me.Requery
Exit_AfterUpdate:
Exit Sub
Err_AfterUpdate:
If Err.Number = 3621 Then
MsgBox "Error has occurred due to duplicate values or blank lines. Please press the ESCAPE button to delete the bad lines and re-enter the information again.", vbOKOnly
response = acDataErrContinue
End If
Resume Exit_AfterUpdate
End Sub
Unfortunately, this has not worked. The standard microsoft error message for Primary key errors continues to show up. I have tried using different names after Exit_ and Err_ (this should not make a difference but it was worth a try) but that did not help. What you are seeing is a compilation of a number of postings in this Access Forms forum in response to primary key errors and custom messages. Can someone lead me in the right direction? Thanks for all help in advance.
Dave
Private Sub Form_AfterUpdate()
On Error GoTo Err_AfterUpdate
Me.Requery
Exit_AfterUpdate:
Exit Sub
Err_AfterUpdate:
If Err.Number = 3621 Then
MsgBox "Error has occurred due to duplicate values or blank lines. Please press the ESCAPE button to delete the bad lines and re-enter the information again.", vbOKOnly
response = acDataErrContinue
End If
Resume Exit_AfterUpdate
End Sub
Unfortunately, this has not worked. The standard microsoft error message for Primary key errors continues to show up. I have tried using different names after Exit_ and Err_ (this should not make a difference but it was worth a try) but that did not help. What you are seeing is a compilation of a number of postings in this Access Forms forum in response to primary key errors and custom messages. Can someone lead me in the right direction? Thanks for all help in advance.
Dave