473,809 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2628
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.Se tFocus
Me.MySubform.Fo rm.MyControl.Se tFocus
Use your own names for MySubform and MyControl.

HTH
- Turtle

"Steve Miles" <el***@hotmail. com> wrote in message
news:b8******** *************** ***@posting.goo gle.com...
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.Fo rm.MyControl.Se tFocus (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********@nos pam.com> wrote in message news:<lX******* ********@newsre ad2.news.atl.ea rthlink.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.Se tFocus
Me.MySubform.Fo rm.MyControl.Se tFocus
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.goo gle.com...
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.Fo rm.MyControl.Se tFocus (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********@nos pam.com> wrote in message

news:<lX******* ********@newsre ad2.news.atl.ea rthlink.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.Se tFocus
Me.MySubform.Fo rm.MyControl.Se tFocus
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
1817
by: Brian Keanie | last post by:
Is it possible to set different colours to each tab in a tabbed subform?
11
3240
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 Spouses address tab show as well. Although the above is the primary issue to resolve, it would also be handy to go a step further...each Address tab has a sub-form with two tabs; Civic Address, and Mailing Address. Being able to click on the Clients...
9
6454
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 closes instead of setting focus to the null field. What am I doing wrong? Do I need to refer to the tab name when I set focus? I sure would appreciate any help! Here is my code: Private Sub Form_BeforeUpdate(Cancel As Integer)
3
2776
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 code for another scenario and it gives me compile error:method or data member not found. My scenario is i have a nested tab page.My main tabbed page has 4 tabs, About, SafetyLevel1,SafetyLevel2,SafetyLevel3. Inside this main, i created a...
9
3665
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 user from clicking on another Tab. I don't want to make the other tabs invisible. I tried setting the subForm so that the user is in Me.Modal=True during the edit, but when this happens - everything becomes modal (ie the MainForm/Subform),...
11
2626
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 customer name etc), this is used as the Primary key to all the tables relating to that customer. I've been using 1 to Many relationships for most of the tables (e.g A customer can have many addresses) with Referential Integrity and cascading turned...
14
10709
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, called "Page75" is a tabbed subform called "RegistrationLaunchTogether" with one of its tabs called "Observations". How do I set the focus on this tab from outside the main form?
3
1640
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, as the subform is not already open. In conjunction with this I have a Select Case statement that auto selects a form to fill this subform I just want the this subform to open if one of the select case form is selected in stead of having click on the...
8
5312
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 has the focus and handle ctrl-c, ctrl-v, or any other shortcuts. I have the same shortcuts working in my app, but have not determined how to find out which control has focus. Would I set up a loop or code for each control at form level. Any help...
0
9603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10640
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10387
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10120
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.