Results 1 to 7 of 7
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Reference Controls in SubForm? (A2k (9.0.3821) SR-1)

    Reference Controls in SubForm?
    A2k (9.0.3821) SR-1

    I use the following commands to reference controls on my Parent Form

    Me.NavigationButtons = False
    Me.Add_Record.Visible = True
    Me.Save_Record.Visible = False

    Me.NavigationButtons = True
    Me.Add_Record.Visible = False
    Me.Save_Record.Visible = True

    Me.strLastName.Locked = True
    Me.strFirstName.Locked = True

    Me.strLastName.Locked = False
    Me.strFirstName.Locked = False

    If I have controls on a sub form, how do I reference them from the Parent Form?

    Any help would be appreciated.

    Thanks, John

  2. #2
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reference Controls in SubForm? (A2k (9.0.3821) SR-1)

    Me.sfrmName.ControlName.Visible = False
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reference Controls in SubForm? (A2k (9.0.3821) SR-1)

    Hi carbonnb

    The following command works OK and locks all the text and combo controls on my datasheet subform:

    Me.PermitSubform.Locked = True

    In addition to text abd combo controls I

  4. #4
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reference Controls in SubForm? (A2k (9.0.3821) SR-1)

    Well if Add_Record is a CommandButton, that's the problem.

    Command button's don't support the locked property.

    You may want to look at the enabled property for the command button.
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reference Controls in SubForm? (A2k (9.0.3821) SR-1)

    Hi cabonnb

    I made cahnges as suggested with same error message.

    The following works fine for button on parent form:

    Me.Cancel_Record.Visible = False

    I use the following commands to reference controls on my Datasheet SubForm from Parent Form

    The following command works OK and locks all the text and combo controls on my datasheet subform:

    Me.PermitSubform.Locked = True

    In addition to text abd combo controls I

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Reference Controls in SubForm? (A2k (9.0.3821) SR-1)

    Try

    Me.PermitSubform.Form.[Add Record].Visible = False

    or

    Me.PermitSubform![Add Record].Visible = False

    (note the ! instead of . separating PermitSubofrm and [Add Record] in the latter)

  7. #7
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reference Controls in SubForm? (A2k (9.0.3821) SR-1)

    Hi Hans

    I got it with this:

    Me!PermitSubform.Form![Add Record].Visible = True

    This reference was what I was looking for, maybe helpful to others:

    Dev Ashish has the best table I've seen for trying to figure out sub and sub-sub form controls and such: Refer to Form and Subform properties and controls. In addition to a great description, you can download the table as a Word document.

    You'll want to save that for future reference

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

    Thanks again, John

    Edited by Charlotte to activate link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •