Need Error Number

B

Bonnie A

Hi everyone! Using A02 on XP. Need to know what the error number is for this
message: "The changes you requested to the table were not successful because
they would create duplicate values in the index, primary key, or
relationship. Change the data in the field or fields that contain duplicate
data, remove the indes, or redefine the index to permit duplicat entries and
try again." I need to show a specific message instead of that one.

Is there a directory for errors? How do I find a list?

Thanks in advance for any help or advice!
 
A

Andy Hull

Hi Bonnie

This is a form error.

If you go to the event tab on the form's property sheet and create an [event
procedure] for the On Error event you can see the error number as follows...

Private Sub Form_Error(DataErr As Integer, Response As Integer)
MsgBox DataErr
End Sub

When you cause the error to occur you will see it reported as number 3022.
Then you can use the following to display your own message...

Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 3022 Then
MsgBox "My Error Message"
Response = acDataErrContinue 'This line stops the default message
End If
End Sub

Another option is to test for this situation in the Before Update event,
cancelling the update if it occurred and then the form error would never
trigger.

hth

Andy Hull
 
B

Bonnie A

Hi Andy,

Thank you VERY much for the info. I will implement ASAP.

I really appreciate you taking time to help others in the newsgroups.
--
Bonnie W. Anderson
Cincinnati, OH


Andy Hull said:
Hi Bonnie

This is a form error.

If you go to the event tab on the form's property sheet and create an [event
procedure] for the On Error event you can see the error number as follows...

Private Sub Form_Error(DataErr As Integer, Response As Integer)
MsgBox DataErr
End Sub

When you cause the error to occur you will see it reported as number 3022.
Then you can use the following to display your own message...

Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 3022 Then
MsgBox "My Error Message"
Response = acDataErrContinue 'This line stops the default message
End If
End Sub

Another option is to test for this situation in the Before Update event,
cancelling the update if it occurred and then the form error would never
trigger.

hth

Andy Hull


Bonnie A said:
Hi everyone! Using A02 on XP. Need to know what the error number is for this
message: "The changes you requested to the table were not successful because
they would create duplicate values in the index, primary key, or
relationship. Change the data in the field or fields that contain duplicate
data, remove the indes, or redefine the index to permit duplicat entries and
try again." I need to show a specific message instead of that one.

Is there a directory for errors? How do I find a list?

Thanks in advance for any help or advice!
 

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