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

Before Deleting record message

Status
Not open for further replies.

kevinbotes

Programmer
Oct 5, 2006
2
ZA
Hi

I have a subform which is shown i data view. if i select a record to delete via the record selectors, ms access pops up a message to confirm. This message is rather complicated for th end user to read.

how can i supress this message and insert my own message for the end user to see ?

Regards

Kev
 
In the BeforeDelConfirm event of your subform, SetWarnings to False and pop up your own msgbox...

Code:
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
   DoCmd.SetWarnings False
   MsgBox ("My own delete message")
End Sub
 
You may also wish to use Form_Error:
Code:
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
    Response = acDataErrContinue
    Cancel = MsgBox("Delete?", vbYesNo) = vbNo
End Sub

Private Sub Form_Error(DataErr As Integer, Response As Integer)
     Const RELATEDRECORD_VIOLATION = 3200
      If DataErr = RELATEDRECORD_VIOLATION Then
         MsgBox "No can do."
         Response = acDataErrContinue
      End If
End Sub
 
Thanks

used first example. second one seems a bit long to get same result.

thanks for the help guys.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top