Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Oct 2006
    Location
    Melbourne, Victoria, Australia
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    can't hide control that has focus (2003)

    Hi all,

    I've got a check box, that when selected (value=true), a number of text boxes become visible (to prompt and allow for data entry). Now, the problem is....these controls are in a tab control (tabCtl3) which is in a sub-form (frmCoMorb) that is in the main tab control (tabCtl5)......so when the user enters data in a now visible text box, then moves to the next record, I keep getting the error "run-time error 2165. can't hide a control that has the focus".

    I've tried to setting the focus on the main form before moving to next record, but error still happening. From what i've read, I think I need to somehow remove the focus from tabCtl3 before moving to next record.....but how? everything i've tried doesn't seem to work.

    Thanks muchly,
    Van

    Thanks, Van

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

    Re: can't hide control that has focus (2003)

    You mention that you make text boxes visible. The error is about hiding a control. Please explain.

  3. #3
    2 Star Lounger
    Join Date
    Oct 2006
    Location
    Melbourne, Victoria, Australia
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: can't hide control that has focus (2003)

    Hi Hans,

    well, the check box is true the text boxes should be visible. if the check box is false, the text boxes should be invisible. I want to be able to move to next record and have text boxes visible or not depending on value in the check box. hope this makes sense.

    :-) Van

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

    Re: can't hide control that has focus (2003)

    Can you set focus to a control in the subform that will always be visible?

  5. #5
    2 Star Lounger
    Join Date
    Oct 2006
    Location
    Melbourne, Victoria, Australia
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: can't hide control that has focus (2003)

    I've used the setfocus method in the after update event of a text box to set the focus to a control on the subform that is always visible as you've suggested.....it works!

    thanks muchly Hans

Posting Permissions

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