Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Help with Run-Time err msg. (XL2000 SR-1)

    <font color=red>Run-time error '2110':

    Can't move focus to the control because it is invisible, not enabled, or
    of a type that does not accept the focus.</font color=red>


    On a multi-page userform, I have the following code assigned to the [ FINISH ] button.

    If IsNumeric(Box_HH) = False Then
    MsgBox "Happy Hour Sales must be a number.", , "Sales"
    Box_HH.SetFocus

    This will check to make sure there's an entry in a txt box and if not, will return the user to that box for editing.

    Problem occurs when the user is on a different page of the userform when the [ FINISH ] button is clicked. Excel can't return focus to a txtbox that it cannot see!
    What do I need to add to the code to direct excel to Page1 of the multi-page userform?
    - Ricky

  2. #2
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Dallas plus 20 miles or so, Texas, USA
    Posts
    876
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Help with Run-Time err msg. (XL2000 SR-1)

    I believe if you will add the following to your code, it will do the trick(y):

    <pre>MultiPage1.Value = 1
    MultiPage1.Pages("Page2").Box_HH.SetFocus
    </pre>


    It seems that the .value property determines which page is active, as opposed to using the activate event or setfocus method. If you set the value property of the page desired, it should return the page which contains the textbox you wish to activate. Pages start at 0 and go up.

    HTH,

  3. #3
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Help with Run-Time err msg. (XL2000 SR-1)

    Thanks Mike:

    I added the code suggested and it worked flawlessly.
    - Ricky

Posting Permissions

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