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

    Problem with Tab Control? (A2k (9.0.4402) SR-1)

    Problem with Tab Control?

    A2k (9.0.4402) SR-1

    I have the following code in On Click event of a Tab Control (Page Index 0)

    When I click on the Tab, focus does not go to Me!cboLookupSequence

    Me!cboLookupSequence is in the Form Footer

    Private Sub Permit_Information_Click()

    Me!cboLookupSequence.SetFocus

    End Sub

    What am I missing?

    Thanks, John Graves

  2. #2
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Problem with Tab Control? (A2k (9.0.4402) SR-1)

    I made a form with a tab control on it and added code to the on click event as you describe and got the result you describe. I even moved the combo box on to the main form. I then put a new combo straight on the tab page and adapted the code as required. Clicking the tab still did not setfocus on the combo box.

    However I discovered that once you have the page selected, move the cursor down on to the page and click. He presto the combo box gets the focus.

    So your first click is in the tab area, which is designated with dotted lines. So this isn

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Problem with Tab Control? (A2k (9.0.4402) SR-1)

    You normally have to use the Change event of the Tab control to get it to respond the way you want it to.
    Charlotte

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

    Re: Problem with Tab Control? (A2k (9.0.4402) SR-1)

    Hi Charlotte

    This works, strPermitSuf is detail section of form

    Private Sub Permit_Information_Click()
    Me!strPermitSuf.SetFocus
    End Sub

    This dosen't work, cboLookupSequence is in the Form Footer

    Private Sub Permit_Information_Click()
    Me!cboLookupSequence.SetFocus
    End Sub

    What am I missing?

    Thanks, John Graves

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Problem with Tab Control? (A2k (9.0.4402) SR-1)

    Sorry, but are we still talking about tab controls here? I'm having a little trouble understanding what you're doing. What is strPermitSuf? Is it a control, a subform, or what? If it's a control or even a subform control, then using SetFocus should work. There's no reason why you shouldn't be able to set the focus to a control in the footer using that syntax unless the control in question and the button you've clicked are on two different forms (i.e., a form and a subform). Could that be what you're dealing with?
    Charlotte

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

    Re: Problem with Tab Control? (A2k (9.0.4402) SR-1)

    This is what I have:

    Form with the following two Tabs Controls and unbound Combo Box in form footer

    Tab A Tab B

    cboLookupSequence (unbound combo box) in the form footer

    Tab A is the main form for Table 1
    Tab B is additional information for Table 1

    This is what I want

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Problem with Tab Control? (A2k (9.0.4402) SR-1)

    Yes, you're fighting built-in behavior. When you click a tab, the focus *always* goes to the first control on the tab page. You can't change that. If you used the GotFocus or Enter event of the first control on the tab page to shift the focus to your combobox, you wouldn't be able to get the user back to that control. On the other hand, if you stick and unbound control in as the first control on the tab page, lock it and make it zero width, then put code in it's gotfocus event to shift the focus to the combobox, that should work.
    Charlotte

Posting Permissions

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