Results 1 to 4 of 4

Thread: Hiding subform

  1. #1
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts
    From the OnCurrent event of a form I am trying to hide the subform on another form. The code below can't find the field 'frmThisCoPhones' (which is the correct name of the subform field).
    Forms![frmThisCoPhonesMain]![frmThisCoPhones].Visible = True

    I varied the code as below but got the same error.
    Forms![frmThisCoPhonesMain]![frmThisCoPhones].Form.Visible = True
    and also changing the point to a bang:
    Forms![frmThisCoPhonesMain]![frmThisCoPhones]!Form.Visible = True


    Obviously I am getting the referencing of the subform wrong, but where?
    Regards,
    Peter

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    [quote name='Peter Kinross' post='781390' date='24-Jun-2009 15:30']From the OnCurrent event of a form I am trying to hide the subform on another form. The code below can't find the field 'frmThisCoPhones' (which is the correct name of the subform field).
    Forms![frmThisCoPhonesMain]![frmThisCoPhones].Visible = True

    I varied the code as below but got the same error.
    Forms![frmThisCoPhonesMain]![frmThisCoPhones].Form.Visible = True
    and also changing the point to a bang:
    Forms![frmThisCoPhonesMain]![frmThisCoPhones]!Form.Visible = True


    Obviously I am getting the referencing of the subform wrong, but where?[/quote]
    What you want to hide is the subform control, so you need to reference the name of the subform control. This name may not be the same as actual form within the control.
    Regards
    John



  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Open frmThisCoPhonesMain in design view.
    Click once on the subform to select it.
    Look at the Properties window to see the name of the subform as a control on the main form. This is not necessarily the same as the name of the subform in the database window (i.e. the Source Object). You must use the control name in your expression.

    Do *not* use the expressions with Form in it.

  4. #4
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='781397' date='24-Jun-2009 15:01']Open frmThisCoPhonesMain in design view.
    Click once on the subform to select it.
    Look at the Properties window to see the name of the subform as a control on the main form. This is not necessarily the same as the name of the subform in the database window (i.e. the Source Object). You must use the control name in your expression.

    Do *not* use the expressions with Form in it.[/quote]
    I can't believe I'm so dumb. I could have sworn that I copied and pasted the subform name - obviously my aim was off.
    Thanks folks
    Attached Images Attached Images
    Regards,
    Peter

Posting Permissions

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