Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error handling with primary key errors in table in data entry

Status
Not open for further replies.

hedgracer

Programmer
Mar 21, 2001
186
US
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
 
I have found the answer to this question. Please do not respond. Thanks.

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top