Tab Control Question

  • Thread starter Thread starter Joe Cilinceon
  • Start date Start date
J

Joe Cilinceon

I'm using a Tab Control to divide up the data entry on a form. Now I would
like to know how I can get it to go to the next page of the control rather
than the next record when hitting a tab in the last field on a page. I hope
that is clear.
 
Joe Cilinceon said:
I'm using a Tab Control to divide up the data entry on a form. Now I would
like to know how I can get it to go to the next page of the control rather
than the next record when hitting a tab in the last field on a page. I hope
that is clear.

Two different issues actually. The Cycle property of the form controls
whether tabbing out of the last record *on the form* takes you back to the
first control on the same record or to the next record. You are currently
set to "All Records". Just change this setting to "Current Record".

As for the tab behavior within TabPages I have always wondered why MS
didn't allow for the option to maintain the same tab behavior WITH TabPages
as without, but we're stuck with how they did it. If you want tabbing out
of the last control on a TabPage to take you to the first control on
another TabPage here is how I do it...

Add a small (but visible = true) TextBox to the first TabPage and make it
last in the TabOrder for that page. In its GotFocus event, add code to set
focus to the desired control on the desired TabPage. Repeat this for the
other TabPages.

Some will tell you to use the Exit or LostFocus of the last existing
control on your TabPage, but I don't recommend that. If you do that then
anytime the user presses <Shift-Tab> or uses the mouse to leave that
control your code will circumvent their intentions and take him to some
other TabPage. With my method they are only taken to the next TabPage when
they use <Tab> or <Enter> to leave the last control on the current TabPage.
 
Rick Brandt said:
Two different issues actually. The Cycle property of the form
controls whether tabbing out of the last record *on the form* takes
you back to the first control on the same record or to the next
record. You are currently set to "All Records". Just change this
setting to "Current Record".

As for the tab behavior within TabPages I have always wondered why MS
didn't allow for the option to maintain the same tab behavior WITH
TabPages as without, but we're stuck with how they did it. If you
want tabbing out of the last control on a TabPage to take you to the
first control on another TabPage here is how I do it...

Add a small (but visible = true) TextBox to the first TabPage and
make it last in the TabOrder for that page. In its GotFocus event,
add code to set focus to the desired control on the desired TabPage.
Repeat this for the other TabPages.

Just to add on to Rick's post, which outlines a method I use also, be
aware that the special text box you use for this purpose can be as small
as you like -- you can set its height and width both to 0 and it will
still work, even though it is effectively invisible.
 
Back
Top