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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trap error on delete

Status
Not open for further replies.

famehrie

ISP
Dec 14, 2002
31
US
Hi,

I have an Access 2000 project running on XP and 2k machines.

I have 3 tables with a related field called ID which has been setup for cascading delete of related recordes. The data is in a number format and is the primary key for each table.

I have a main form with a delete command button.

The deletion works fine and I am not having a problem with it.

What I want to do is trap and then change the message that comes up for confirming the deletion. Here is the exact message.

Relationships that specify cascading deletes are about to cause 1 record(s) in this table and related tables to be deleted.
Are you sure you want to delete these records.
options are Yes/No/Help


In addition if you select "No" a second message box comes up with the following.

The DoMenuItem action was cancled.
Options are "OK"


Again what I want to do is trap these messages and change them to something more informative to the user.

I am somewhat familiar with error trapping and what I need is the error number or function for this message so I can trap it in an On Error event. Does anyone know what these numbers may be? Or if you have any other suggestions I am open to them.

Thanks

Kevin
 
Private Sub Form_BeforeDelete(Cancel As Integer)
DoCmd.SetWarnings False

If MsgBox("Are you sure?",vbYesNo + vbDefaultButton2) = vbNo Then
Cancel = True
MsgBox "Action canceledd"
Else
MsgBox "Success"
End If

DoCmd.SetWarnings False
End Sub


But...I'd rather not use bound forms for edits, additions and deletions...

HTH

[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top