Help with Referencing Forms and Subforms

  • Thread starter Thread starter John Ortt
  • Start date Start date
J

John Ortt

Hi everyone.

I have the following module which is intended to enable/disable data entry
in a subform.
Can anyone see what I am doing wrong please?

Thankyou,

John

P.S. subPeople1 is the name of the subform object on frmMainMenu. The form
it references is fsubpeople

-----------------

Private Sub cmdChangeDetails_Click()

If Me.cmdChangeDetails.Caption = "Edit Personnal Details" Then
Me.cmdChangeDetails.Caption = "Save Personnal Details"
Forms!frmMainMenu!fsubpeople.Form.Enabled = True
Forms!frmMainMenu!fsubpeople.Form.Locked = False
Else
Me.cmdChangeDetails.Caption = "Edit Personnal Details"
Forms!frmMainMenu!fsubpeople.Form.Enabled = False
Forms!frmMainMenu!fsubpeople.Form.Locked = True
End If

End Sub
 
You need to use the name of the SubformControl, i.e. the Control object on
the Main Form, not the name of the Form being used as the Subform (more
technically correct, being use as the SourceObject of the SubformControl).

See The Access Web article:

http://www.mvps.org/access/forms/frm0031.htm

for more info.
 
Back
Top