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

Call a function from Before Del Confirm event? (Access 2000)

Status
Not open for further replies.

MackC

Programmer
Nov 8, 2001
23
0
0
US
Is there any way to call a function from the Before Delete Confirm and After Delete Confirm events of a form using the standard arguments, for example,
BeforeDelConfirm: =SuppressDelConfirm(Cancel, Response)
or can you only use event procedures with these events?

The is the function (in a standard module) mentioned above:

Function SuppressDelConfirm(Cancel As Integer, Response As Integer)
Dim frm As Form
Set frm = Screen.ActiveForm
Response = acDataErrContinue
' Display custom dialog box.
If MsgBox("Delete this record?", vbOKCancel) = vbCancel Then
Cancel = True
End If
End Function
 
I believe you can only use Event Procedures but you wouldn't need the function

Example:
Code:
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)

Dim frm As Form
Set frm = Screen.ActiveForm
Response = acDataErrContinue
' Display custom dialog box.
If MsgBox("Delete this record?", vbOKCancel) = vbCancel Then
Cancel = True
End If

End Sub



HTH
Mike

[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top