How to use "Tab" key to navigate a form?

  • Thread starter Thread starter Amit
  • Start date Start date
A

Amit

Hi,

I have a form with multiple tab sheets. Is it possible to
move to the first control on the second tab sheet, by
pressing TAB key on the last control on the first tab
sheet?? Right now, pressing the TAB key from the last
control moves to a new record on the same tab sheet.

TIA.

-Amit
 
Amit said:
Hi,

I have a form with multiple tab sheets. Is it possible to
move to the first control on the second tab sheet, by
pressing TAB key on the last control on the first tab
sheet?? Right now, pressing the TAB key from the last
control moves to a new record on the same tab sheet.

Add a small (non-hidden) TextBox to the first page of the TabControl and set it last
in the TabOrder. Then in its GotFocus event add a line of code to set focus to the
desired control on the second TabPage.
 
-----Original Message-----
Add a small (non-hidden) TextBox to the first page of the TabControl and set it last
in the TabOrder. Then in its GotFocus event add a line of code to set focus to the
desired control on the second TabPage.

Hi Rick,

Thanks for the prompt response!! Instead of adding a small
TextBox, I added the following code in the last
control's "On Lost Focus" Property: "Me.
[nextfieldname].SetFocus" .

It _seems_ to be working fine, but I'm not a VBA expert,
and was wondering if this will work fine too (instead of
what you suggested). If you know that this will cause any
problems/bugs, please let me know.

Thanks!

-Amit
 
Amit said:
Hi Rick,

Thanks for the prompt response!! Instead of adding a small
TextBox, I added the following code in the last
control's "On Lost Focus" Property: "Me.
[nextfieldname].SetFocus" .

It _seems_ to be working fine, but I'm not a VBA expert,
and was wondering if this will work fine too (instead of
what you suggested). If you know that this will cause any
problems/bugs, please let me know.

The advantage of my method is that the user only enters the small control when they
use <Tab> or <Enter> from the last control on the first TabPage which is when you
would want them to go the next TabPage. With your method when the user uses
<Shift-Tab> to go backwards or uses the mouse to click somewhere else your code will
override what they want to do and jump them to the control on the second TabPage.
 
Your alternate solution to Rick's suggestion will also work, unless you use
a mouse. When you click outside of the last text box it will automatically
move you to that next tab page instead of putting the focus onto where you
clicked.

Kelvin Lu

Amit said:
-----Original Message-----


Add a small (non-hidden) TextBox to the first page of the TabControl and set it last
in the TabOrder. Then in its GotFocus event add a line of code to set focus to the
desired control on the second TabPage.

Hi Rick,

Thanks for the prompt response!! Instead of adding a small
TextBox, I added the following code in the last
control's "On Lost Focus" Property: "Me.
[nextfieldname].SetFocus" .

It _seems_ to be working fine, but I'm not a VBA expert,
and was wondering if this will work fine too (instead of
what you suggested). If you know that this will cause any
problems/bugs, please let me know.

Thanks!

-Amit
 
Thanks, Rick and Kelvin.

What you wrote makes sense!! Changed it, tried it and it
works great!! :)

-Amit
-----Original Message-----
Your alternate solution to Rick's suggestion will also work, unless you use
a mouse. When you click outside of the last text box it will automatically
move you to that next tab page instead of putting the focus onto where you
clicked.

Kelvin Lu

Amit said:
-----Original Message-----
Hi,

I have a form with multiple tab sheets. Is it
possible
to
move to the first control on the second tab sheet, by
pressing TAB key on the last control on the first tab
sheet?? Right now, pressing the TAB key from the last
control moves to a new record on the same tab sheet.

Add a small (non-hidden) TextBox to the first page of
the
TabControl and set it last
in the TabOrder. Then in its GotFocus event add a line of code to set focus to the
desired control on the second TabPage.

Hi Rick,

Thanks for the prompt response!! Instead of adding a small
TextBox, I added the following code in the last
control's "On Lost Focus" Property: "Me.
[nextfieldname].SetFocus" .

It _seems_ to be working fine, but I'm not a VBA expert,
and was wondering if this will work fine too (instead of
what you suggested). If you know that this will cause any
problems/bugs, please let me know.

Thanks!

-Amit


.
 
Back
Top