Need Error Number to trap

B

Bonnie

Hello everyone! Using A02 on XP. I needed to trap the
error about cannot add record as it would create duplicate
value...; trap 3022. It identified itself. Now I'm
getting: DoMenuItem was cancelled. What error number do I
trap? Is there a list somewhere?

Thanks in advance for any help or advice!
 
A

Alphonse Giambrone

In your error handler, just add the line
msgbox err.number
that will give you the number so you can trap it.
 
D

Don Wilson

**********************************************************
Try creating a blank, (empty) database, then do an import.

**********************************************************
 
B

Bonnie

Huh??? Okay, I created a blank DB, and imported the table
and query and form, spent 20 minutes disconnecting all the
sub-sub forms and code. I'm still getting the same error.
What now? Here's what I have:

Private Sub Command79_Click()
On Error GoTo Err_Command79_Click


DoCmd.GoToRecord , "Data Entry Form", acNewRec

Exit_Command79_Click:
Exit Sub
Err_Command79_Click:
Select Case Err.Number
Case 3022
MsgBox "A record containing the Plan Number and
Check Number you have keyed in already exist, please check
your data. Close the form and reopen to enter additional
records."
Resume Next
Case Else
MsgBox Err.Description
Resume Exit_Command79_Click
End Select

End Sub

Any help or advice would be appreciated! Thx!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top