Need to tab between fields on seperate tab controls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that has numerous fields, and I have broken them down into
logical groups using a Tab Control. I currently have 6 tabs on the control.

My problem is that I want to go from the last field on one tab to the first
field on the next tab without having the record saved until tabbing through
the last field on the last tab. I tried changing the tab order, but the tab
order only shows the order of the fields on
the active tab.

I'm quite certain I'll need to use VBA code. Someone once mentioned moving
the focus to the desired control on the using the Exit event of the last
control on the onetab page to set the focus to the first control on the next
tab page. However, I have no idea what the code would look like. Do any of
you VBA geniuses have an idea?

I'd appreciate any help i can get :)
 
Try using this: Me!TabCtl1.Pages(1).SetFocus

Change TabCtl1 to the name of your tab control. Remember that the
pages start from (0). First tab = .Page(0) Second tab = .Page(1)
etc.... And yes place this in the last fields OnExit.

Hope this helps.
 
Penguin said:
Try using this: Me!TabCtl1.Pages(1).SetFocus

Change TabCtl1 to the name of your tab control. Remember that the
pages start from (0). First tab = .Page(0) Second tab = .Page(1)
etc.... And yes place this in the last fields OnExit.

Actually it would be better to create a dummy control as the last one in the
TabOrder of the first page and use its GotFocus event to transfer focus to the
desired control on the next page. This control can be made tiny so as to be
virtually invisible while leaving its actual Visible property set to True.

The difference is that with the dummy control method, the user is only taken to
the second page automatically if they leave the last *real* control on the first
page by use of the <Tab> or <Enter> key. This allows <Shift Tab> to still work
as desired and doesn't interfere with their use of the mouse to click on a
different control.

Using the Exit event strategy will mean that if the user does use <Shift Tab> or
the mouse the Exit code will take them uncermoniously to a different control
than they wanted.
 
Back
Top