Hi Guys,
I have searched the forum for the answer to this question but have not found the solution yet.
I would like to get rid of as many macros in my database as possible and rely on the VBA. I have a button to delete a record on my mainform, which I have put the following code:
I have tried this code with a normal form and it does seem to work but my form has 3 subforms in it on tabbed pages.
My question is how do I get the code to work and delete the record including the other information referenced in the subforms? How do I select this info in code??
Thanks v much!
VB
I have searched the forum for the answer to this question but have not found the solution yet.
I would like to get rid of as many macros in my database as possible and rely on the VBA. I have a button to delete a record on my mainform, which I have put the following code:
Code:
Private Sub cmdDeleteSupplier_Click()
If (MsgBox("Deleting a supplier record will permanently delete it. Are you sure you want to delete?", vbYesNo, "Delete Confirmation")) = vbYes Then
If Me.Dirty Then
Me.Undo
DoCmd.SetWarnings False
If Not Me.NewRecord Then
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
End If
End If
MsgBox "The supplier was successfully deleted.", , "Delete Confirmation"
End If
End Sub
I have tried this code with a normal form and it does seem to work but my form has 3 subforms in it on tabbed pages.
My question is how do I get the code to work and delete the record including the other information referenced in the subforms? How do I select this info in code??
Thanks v much!
VB
