Help with Referencing Forms and Subforms

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
 
V

Van T. Dinh

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top