I have a form with a subform. The form has a Save button with the following code:
Private Sub SaveRec_Click()
On Error GoTo Err_SaveRec_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me.AllowEdits = False
Me.AllowAdditions = False
Me.AllowDeletions = False
Me.sbfLINEITEMS.Form.AllowAdditions = False
Me.sbfLINEITEMS.Form.AllowEdits = False
Me.sbfLINEITEMS.Form.AllowDeletions = False
Refresh
Exit_SaveRec_Click:
Exit Sub
Err_SaveRec_Click:
MsgBox “The Save Record function is unavailable because the record was not changed.”
Resume Exit_SaveRec_Click
End Sub
The Save button works as desired if I press it when I’m on the main form. AllowEdits, AllowAdditions, and AllowDeletions get set to False and the form (including the subform) is ‘locked’ again. However, when I press the Save button when I’m in the subform (sbfLINEITEMS), none of the Save button actions occur (AllowEdits, AllowAdditions, and AllowDeletions don’t get set to False for either the main form or the subform). I’ve tried resetting the focus to a control on the main form before the Save actions occur…that didn’t do anything. I know I’m missing something with regard to the interaction betweens forms and subforms, but I don’t know what. Any help would be appreciated. Thank you.