Folks,
Happy Friday! (or whatever day it is for you...)
I have a report with a detail section that shows data for one record, for example for a procedure that was performed. When you open the report you have a series of detail sections each showing the data for a different procedure. At the bottom of the detail section there are buttons for "menu" (opens the menu which is a switchboard form I made) "delete record" (which has code to delete the record, below), and a "close" button (closes the report and opens the menu). I just started wondering...if my (one) user chooses "delete" and confirms their selection...will it delete just that record or will it delete all records for all procedures showing in the report?
<Code>
Private Sub cmdDelete_Click()
Dim lResponse As Long
Dim sPrompt As String
On Error GoTo ErrHandler
sPrompt = "Are you sure you want to delete this record?"
lResponse = MsgBox(sPrompt, vbQuestion + vbYesNo, "DeleteRecord")
If lResponse = vbYes Then
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
End If
ErrExit:
Exit Sub
ErrHandler:
MsgBox "Error is " & Err.Description
Resume ErrExit
End Sub
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
' Suppress default Delete Confirm dialog box because I made my own for cmdDelete
Response = acDataErrContinue
End Sub
</Code>
Thanks for your help!