By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,830 Members | 682 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,830 IT Pros & Developers. It's quick & easy.

Keyboard set focus in tabbed subform?

P: n/a
I've got a tabbed form with the 2nd tab containing a subform. I'm
trying to avoid the need to use the mouse to set focus to the first
field on the subform. I can use <CTRL><TAB> to open the 2nd tab, but
I can't get the first field to receive focus until I click in it.
Here's what I've already tried/checked:

1) I've commented out the "On Current" event VB code.

2) The first field IS a tab stop and it's first on the tab order.

3) Using VB code behind various events to set focus to the field.

4) Find a keystroke sequence that'll set focus to the field.

The weird thing is this .MDB has 3 other forms that are almost exactly
like the one that doesn't work...and they all work properly.

Any suggestions on how to set focus to a field on a subform off a tab
on a main form without using the mouse?
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Your tab control should have a Change event.
In that event, you should check whether the value of the tab control is 2.
(This tells you that you have selected the second tab.)
In this case, you can use code like this:
Me.MySubform.SetFocus
Me.MySubform.Form.MyControl.SetFocus
Use your own names for MySubform and MyControl.

HTH
- Turtle

"Steve Miles" <el***@hotmail.com> wrote in message
news:b8**************************@posting.google.c om...
I've got a tabbed form with the 2nd tab containing a subform. I'm
trying to avoid the need to use the mouse to set focus to the first
field on the subform. I can use <CTRL><TAB> to open the 2nd tab, but
I can't get the first field to receive focus until I click in it.
Here's what I've already tried/checked:

1) I've commented out the "On Current" event VB code.

2) The first field IS a tab stop and it's first on the tab order.

3) Using VB code behind various events to set focus to the field.

4) Find a keystroke sequence that'll set focus to the field.

The weird thing is this .MDB has 3 other forms that are almost exactly
like the one that doesn't work...and they all work properly.

Any suggestions on how to set focus to a field on a subform off a tab
on a main form without using the mouse?

Nov 13 '05 #2

P: n/a
Thanks for the tip. I can use the change event of the tab control to
check which tab I'm on and I tried the
me.MySubForm.Form.MyControl.SetFocus (substituting my appropriate
values). It works on everything but NEW records.

I'm using standard master/detail tables. Tab 0 holds fields from the
master and tab 1 is further details about the master record. Tab 1
has records from a second table, joined by primary/foreign key. Focus
is properly set as long as I don't create a new master record then
click Tab 1.

Any thoughts anyone??
"MacDermott" <ma********@nospam.com> wrote in message news:<lX***************@newsread2.news.atl.earthli nk.net>...
Your tab control should have a Change event.
In that event, you should check whether the value of the tab control is 2.
(This tells you that you have selected the second tab.)
In this case, you can use code like this:
Me.MySubform.SetFocus
Me.MySubform.Form.MyControl.SetFocus
Use your own names for MySubform and MyControl.

Nov 13 '05 #3

P: n/a
Does your new master record get saved before you move to Tab 1?
Did you include moving focus to the subform control on the main form before
you move it to the control on the subform?

- Turtle

"Steve Miles" <el***@hotmail.com> wrote in message
news:b8**************************@posting.google.c om...
Thanks for the tip. I can use the change event of the tab control to
check which tab I'm on and I tried the
me.MySubForm.Form.MyControl.SetFocus (substituting my appropriate
values). It works on everything but NEW records.

I'm using standard master/detail tables. Tab 0 holds fields from the
master and tab 1 is further details about the master record. Tab 1
has records from a second table, joined by primary/foreign key. Focus
is properly set as long as I don't create a new master record then
click Tab 1.

Any thoughts anyone??
"MacDermott" <ma********@nospam.com> wrote in message

news:<lX***************@newsread2.news.atl.earthli nk.net>...
Your tab control should have a Change event.
In that event, you should check whether the value of the tab control is 2. (This tells you that you have selected the second tab.)
In this case, you can use code like this:
Me.MySubform.SetFocus
Me.MySubform.Form.MyControl.SetFocus
Use your own names for MySubform and MyControl.

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.