473,386 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Keyboard set focus in tabbed subform?

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
3 2599
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Brian Keanie | last post by:
Is it possible to set different colours to each tab in a tabbed subform?
11
by: Dave | last post by:
Access 2003 I have a main form with two tab forms, one showing Client, and the other Spouse info, each with Address tabs. When I click on the Client address tab, I would like to have the...
9
by: Mary | last post by:
I have a tabbed form. Tab 1 has fields that are mandatory. I am trying to validate that these fields are not null, and cancel updating if any of them are. The following code works, except the form...
3
by: kev | last post by:
Hello, I posted a question a while ago on tabbed pages, how to set it to invisible when the text box is empty.It was answered by Rick and the code ran perfectly. However, i tried using the same...
9
by: ApexData | last post by:
My main form has tab-pages. On each tabbed page is a subform control containing a different subform. When a user selects a specific tab and begins to edit a record, I need a way of preventing the...
11
by: AndyM | last post by:
Hi, I have a curious problem that is causing me large amounts of grief and is steadily turning me grey. Hopefully you guys can help. I have a Master table that contains a CustomerID (as well as...
14
Ericks
by: Ericks | last post by:
Setting focus is addressed through several questions on this forum but I find this so complicated that I need a taylormade answer. I have a tabbed main form called "Compounds". On one of the tabs,...
3
by: DeanO | last post by:
I have a new problem I have a Form with three tabs. I want the third tab to open auto when a text box on the first tabbed subform is updated. I have tried the SetFocus event but this will not work,...
8
by: BD | last post by:
How can I duplicate the behavior of the operating system shortcut keys in my application? For example, my windows form has 5 controls (textboxes), the operating system will pickup which control...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.