G
Guest
Hi,
I have a form with a subform containing the child records. This sub form
also contains a sub form with another level of child records
(grand-children). Now, I want my personalized Delete button (placed in the
form header) to delete oinly the record that is selected, the grand-parent,
the parent or the child according to the user's selection.
Can that be done?
How do I recognize or check which record is selected.
The code I wrote for first try deletes the grand parent record when the
grand child is selected.
Private Sub cmdDelete_Click()
strMsg = "Delete this record?"
intStyle = vbQuestion + vbYesNo + vbDefaultButton2
intResponse = MsgBox(strMsg, intStyle, strcTitle)
If intResponse = vbYes Then
DoCmd.RunCommand acCmdDeleteRecord
Else
MsgBox "Operation cancelled"
End If
End Sub
I set cascade delete on all related tables.
I use Access 2000 (actually my users).
Thanks for your help.
I have a form with a subform containing the child records. This sub form
also contains a sub form with another level of child records
(grand-children). Now, I want my personalized Delete button (placed in the
form header) to delete oinly the record that is selected, the grand-parent,
the parent or the child according to the user's selection.
Can that be done?
How do I recognize or check which record is selected.
The code I wrote for first try deletes the grand parent record when the
grand child is selected.
Private Sub cmdDelete_Click()
strMsg = "Delete this record?"
intStyle = vbQuestion + vbYesNo + vbDefaultButton2
intResponse = MsgBox(strMsg, intStyle, strcTitle)
If intResponse = vbYes Then
DoCmd.RunCommand acCmdDeleteRecord
Else
MsgBox "Operation cancelled"
End If
End Sub
I set cascade delete on all related tables.
I use Access 2000 (actually my users).
Thanks for your help.