473,405 Members | 2,354 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,405 software developers and data experts.

How to setfocus on a tab in a subform that sits on parent tab?

176 100+
TabCtrl ---
..............Tab1--Subform1
..............Tab2--Subform2---TabCtrl2---Tab21
.................................................. ........---Tab22
.................................................. ........---Tab23
..............Tab3--Subofrm3

I need to setfocus on Tab22
I've tryed - me.Tab2.Tab22.setfocus and me.Tab2.Subform2.Tab22.setfocus
and me.Tab2.Subform2.Form.Tab22.setfocus with no success.

Help will be apritiated.
Feb 11 '07 #1
12 2855
MMcCarthy
14,534 Expert Mod 8TB
TabCtrl ---
..............Tab1--Subform1
..............Tab2--Subform2---TabCtrl2---Tab21
.................................................. ........---Tab22
.................................................. ........---Tab23
..............Tab3--Subofrm3

I need to setfocus on Tab22
I've tryed - me.Tab2.Tab22.setfocus and me.Tab2.Subform2.Tab22.setfocus
and me.Tab2.Subform2.Form.Tab22.setfocus with no success.

Help will be apritiated.
Michael,

If you are talking about a multi page layout here then you will find that it is the page that gets focus not the tab.

Mary
Feb 11 '07 #2
Michael R
176 100+
Michael,

If you are talking about a multi page layout here then you will find that it is the page that gets focus not the tab.

Mary
Mary,

I don't understand what do you mean by 'multy page layout'.
To setfocus to a mysubform which sits on Tab1 of TabCtrl, I compose - me.Tab1.setfocus. Here I want to setfocus to a mysubform which sits on Tab22 of TabCtrl2, while TabCtrl2 being a control of subform2 which subsequently sits on Tab2 of TabCtrl.
Feb 11 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
Mary,

I don't understand what do you mean by 'multy page layout'.
To setfocus to a mysubform which sits on Tab1 of TabCtrl, I compose - me.Tab1.setfocus. Here I want to setfocus to a mysubform which sits on Tab22 of TabCtrl2, while TabCtrl2 being a control of subform2 which subsequently sits on Tab2 of TabCtrl.
I don't know what you mean by Tab1 of TabCtrl. I assumed you were using a multi page object which looks like grey rectangle with tabs accross the top.

Mary
Feb 11 '07 #4
Michael R
176 100+
I don't know what you mean by Tab1 of TabCtrl. I assumed you were using a multi page object which looks like grey rectangle with tabs accross the top.

Mary

Perhaps I should use the word 'Page' instead of 'Tab'. Do we refer to the same thing? (I think so)
What I'm using is a mainform with TabCtrl control with the pages Page1, Page2, Page3. Page2 has a Subform2 in it, which has TabCtrl2 in it, which has Page21, Page22 in it. I want to set focus on Page22 from mainform, and I don't know how to compose the syntax of this command correctly.

Regards.
Feb 11 '07 #5
MMcCarthy
14,534 Expert Mod 8TB
Perhaps I should use the word 'Page' instead of 'Tab'. Do we refer to the same thing? (I think so)
What I'm using is a mainform with TabCtrl control with the pages Page1, Page2, Page3. Page2 has a Subform2 in it, which has TabCtrl2 in it, which has Page21, Page22 in it. I want to set focus on Page22 from mainform, and I don't know how to compose the syntax of this command correctly.

Regards.
Try ...

Expand|Select|Wrap|Line Numbers
  1. Me.Subform2.Page22.SetFocus
just one thing. Make sure that Subform2 is the name of the subform object and not just the name of the form the subform is based on. To do this go to the properties of the subform object and in the Other tab see what is entered in the Name property.

Mary
Feb 11 '07 #6
nico5038
3,080 Expert 2GB
You don't use a reference to the tabcontrol when referring to the objects on a tab.
You can use for the subform2 e.g.:
Me.subform2.form.fieldname
and you'll get the value of the field on the subform.

When you have a sub sub form you use:
Me.subform2.form.subsubform1.form.fieldname
Tab's don't "count". :-)

Nic;o)
Feb 11 '07 #7
Michael R
176 100+
Try ...

Expand|Select|Wrap|Line Numbers
  1. Me.Subform2.Page22.SetFocus
just one thing. Make sure that Subform2 is the name of the subform object and not just the name of the form the subform is based on.
I understand what do you mean, yes, that is the name of the subform control. (I'm not expertized enogh in programming to fully understand what's an object, for now I realise it's something made of propreties and events) Concerning the command you gave me, it doesn't work. (Method or data member not found error)
Feb 11 '07 #8
MMcCarthy
14,534 Expert Mod 8TB
I understand what do you mean, yes, that is the name of the subform control. (I'm not expertized enogh in programming to fully understand what's an object, for now I realise it's something made of propreties and events) Concerning the command you gave me, it doesn't work. (Method or data member not found error)
Where are you putting this command?
Feb 11 '07 #9
Michael R
176 100+
Where are you putting this command?
In the main form On Open event.
Feb 11 '07 #10
ADezii
8,834 Expert 8TB
Perhaps I should use the word 'Page' instead of 'Tab'. Do we refer to the same thing? (I think so)
What I'm using is a mainform with TabCtrl control with the pages Page1, Page2, Page3. Page2 has a Subform2 in it, which has TabCtrl2 in it, which has Page21, Page22 in it. I want to set focus on Page22 from mainform, and I don't know how to compose the syntax of this command correctly.

Regards.
You cannot set Focus to Page22 on a Tab Control on a Sub-Form contained within a Page on a Tab Control on the Main Form unless that specifc Page is active. You can set the Focus to Page 22 on TabCtrl2 but unless Page2 on the Parent Tab is visible, you will never see it. What you need is a 2 step process:
Expand|Select|Wrap|Line Numbers
  1. 'First, set the Focus to SubForm2 residing on Page 2 of the Tab 
  2. Control on the Main Form. Forget Page 2 and the Main Tab Control, 
  3. they are irrelevant.
  4. Forms!frmYourMainForm![SubForm2].SetFocus
  5.  
  6. 'Set the specifc Value for Page22 which can be obtained via the Value 
  7. Property of the Tab Control in the OnChange() Event.
  8. Forms!frmYourMainForm![SubForm2].Form![TabCtrl2].Value = XX
  9.  
  10. NOTE: This can all be done from the Main Form.
Feb 12 '07 #11
Michael R
176 100+
You cannot set Focus to Page22 on a Tab Control on a Sub-Form contained within a Page on a Tab Control on the Main Form unless that specifc Page is active. You can set the Focus to Page 22 on TabCtrl2 but unless Page2 on the Parent Tab is visible, you will never see it. What you need is a 2 step process:
Expand|Select|Wrap|Line Numbers
  1. 'First, set the Focus to SubForm2 residing on Page 2 of the Tab 
  2. Control on the Main Form. Forget Page 2 and the Main Tab Control, 
  3. they are irrelevant.
  4. Forms!frmYourMainForm![SubForm2].SetFocus
  5.  
  6. 'Set the specifc Value for Page22 which can be obtained via the Value 
  7. Property of the Tab Control in the OnChange() Event.
  8. Forms!frmYourMainForm![SubForm2].Form![TabCtrl2].Value = XX
  9.  
  10. NOTE: This can all be done from the Main Form.
ADezii, though I didn't understand what exactly you suggested me to do with the specific value of Tab Control on OnChange event, I did manage to preform the task of opening Page22 with the help of your advice by first "opening the road" for Page2, and then using Subform2 On Open event to further open Page22. It works great!
Thanks :)
Feb 12 '07 #12
ADezii
8,834 Expert 8TB
ADezii, though I didn't understand what exactly you suggested me to do with the specific value of Tab Control on OnChange event, I did manage to preform the task of opening Page22 with the help of your advice by first "opening the road" for Page2, and then using Subform2 On Open event to further open Page22. It works great!
Thanks :)
Sorry for the confusion. As far as the Value Property, if you place Debug.Print Me![TabControlName].Value in the On Change() Event of a Tab Control it will return the value associated with the specifc Page you clicked on. Knowing that value, you can now assign it to the Tab Control (Me![TabControlName].Value = XX) to go to any Page. In any event, I'm glad to be of assistance.
Feb 12 '07 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name...
4
by: Michael Fay | last post by:
There have been threads in this newsgroup explaining how to tab out of a subform to the parent form -- without having to use ctrl-tab (of which users might be unaware -- and at any rate, they...
2
by: Axel | last post by:
Hi, a question about something that seems very simple at first glance: is it possible to reference other controls of a subform in a query window without referencing through the parent form? I...
4
by: Ryan | last post by:
I've got a little bit of code that runs when you enter data in a datasheet view (which is a subform of the form you are in) if rst!DateReceived >= 30 Then Forms!DisposalRecords.Label90.Caption =...
1
by: google | last post by:
I have a form with several subforms. Users enter the data, then on the parent there is a command button that runs code to generate a .pdf document from a report based on the data they are working...
7
by: Hong | last post by:
Hi I have a main form with 7 subforms where the master/child link is the RefID in the main form where the Main form is 1-many relationship to those subforms. All the subform have the same...
13
by: bitsnbytes64 | last post by:
Hi, I have a form which contains a subform. Both are were creetd using the form wizard and are bound by the column IXO_NR (on two different tables), which is the control source for a textbox on...
8
by: OldBirdman | last post by:
This should be so, so simple I hesitate to ask. I have a Form named "fNavButtons" used as a SubForm in control named "subformNavButtons". subformNavButtons is a control on my main form named...
3
by: ckrows | last post by:
I have a main form with a button that makes a subform visible. I added a button in the form footer of the subform that is supposed to hide the subform. This does not work because the focus is on...
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: 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: 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
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...
0
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,...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.