Jack:
The mainform name: XXXXX
The subform name: TrialCadetAdd
Mainform control commandbutton name:cmdDeleteCadets
The command button is located in the main form and performs the update query on the subform.
Here is the code I have for the command button:
Private Sub cmdDeleteCadets_Click()
Dim MsgResult As Variant
On Error GoTo Err_cmdDeleteCadets_Click
MsgResult = MsgBox("Are you sure you want to delete all the cadets now?", vbYesNo)
If MsgResult = vbYes Then
Dim stDocName As String
stDocName = "DeleteCadetIdQuery"
DoCmd.OpenQuery stDocName, acNormal, acEdit
End If
Exit_cmdDeleteCadets_Click:
Exit Sub
Err_cmdDeleteCadets_Click:
MsgBox Err.Description
Resume Exit_cmdDeleteCadets_Click