Tab Control on form...

G

Guest

I have a form and made a tab control with 2 pages, when I click the tab
button it only goes through the first page then to the first tab on the main
form. How do I get it to go to the 2 page, then after entering the info in
last field on 2nd page go to the first field on the main form?


Thanks
 
D

Douglas J. Steele

In the LostFocus event of the last control on the first tab, put logic to
set focus to the first control on the second tab. Do the same in the
LostFocus event of the last control on the second tab to set focus on the
first control on the first tab.
 
G

Guest

Thank you that worked.

Douglas J. Steele said:
In the LostFocus event of the last control on the first tab, put logic to
set focus to the first control on the second tab. Do the same in the
LostFocus event of the last control on the second tab to set focus on the
first control on the first tab.
 
J

John W. Vinson

I have a form and made a tab control with 2 pages, when I click the tab
button it only goes through the first page then to the first tab on the main
form. How do I get it to go to the 2 page, then after entering the info in
last field on 2nd page go to the first field on the main form?

You can put a little unbound textbox last in the tab order on the first page.
It must be enabled and visible (or it won't let you tab to it!), but you can
put it behind some other control so the user can't tab into it. In its
GotFocus event set the focus explicitly to the desired control:

Private Sub txtRelay_GotFocus()
Me!controlname.SetFocus
End Sub

There's no need to specifically name the second page- setting focus to a
control on the page will open the page.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top