Results 1 to 9 of 9
  1. #1
    Star Lounger
    Join Date
    Feb 2001
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hide Field on Subform

    I am using a Tab Control with subforms. I would like to hide a field on the subform when the file opens. This should be really simple but I am having trouble.....help!!

  2. #2
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Field on Subform

    You can set the visible property of the control to NO or in code Me.mycontrol.Visible = False

  3. #3
    Star Lounger
    Join Date
    Feb 2001
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Field on Subform

    The field I am trying to hide is located on a tab control in a subform. This subform is also used on another form so I can't set the control visible property to no.

    I have tried using "Me.sfmJobs![cboProject].Visible = False" in the onOpen event of the form, however, this doesn't work. I receive a runtime error 2165 stating you can not hide a control that has the focus.

  4. #4
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Field on Subform

    How about setting the Height and Width Properties to "0" Zero to hide it?

  5. #5
    Star Lounger
    Join Date
    Feb 2001
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Field on Subform

    This subform is also used/shared as a subform for other forms. Changing any of the control properties would also be reflected in all instances the subform it is used in. I need to be able to hide the control of a subform when the parent form is opened.

  6. #6
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Field on Subform

    Wouldn't this work:
    <hr>Me.sfmJobs![cboProject].Height =0
    Me.sfmJobs![cboProject].Width =0 in the onOpen event of the form. <hr>

  7. #7
    Star Lounger
    Join Date
    Feb 2001
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Field on Subform

    I figured it out!

    If I set the tab stop property of the control to "no" and then use the onOpen event of the form with 'Me.sfmJobs![cboProject].visible = False' it works fine!!

    [img]/w3timages/icons/clever.gif[/img]

  8. #8
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Field on Subform

    Right you are! That's great. [img]/w3timages/icons/smile.gif[/img]

  9. #9
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Altnau, Thurgau, Switzerland
    Posts
    447
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Field on Subform

    Before setting the visible property to false set the focus to another control.

Posting Permissions

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