A2003 - Tab to Tab Focus | | |
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 Civic address tab, and viewing the Spouses Civic Address tab
would be handy.
Any guidance would be greatly received.
Dave
Forms:
Main Form: frmMain
- Client Tab Form: TabMainClient
- Tab One: TabClient
- Tab Two: TabClientAddresses
- sfrmClientAddresses
- TabClientAddresses
- TabClientCivic
- TabClientMailing
- Spouse Tab Form: TabMainSpouse
- Tab One: TabSpouse
- Tab Two: TabSpouseAddresses
- sfrmSpouseAddresses
- TabClientAddresses
- TabSpouseCivic
- TabSpouseMailing | | | | re: A2003 - Tab to Tab Focus
I believe Forms!TabMainSpouse!TabSpouseAddresses.SetFocus is very
roughly the syntax you're looking for. I'm not entirely sure about the
hierarchy of your forms...TabMainClient and TabMainSpouse are subforms
of another form? and they have their own subforms? A bit confused I am,
as usual.
You can put code in the OnClick() event of a tabpage to set the focus
to another object. Does that help? | | | | re: A2003 - Tab to Tab Focus
Steve wrote:[color=blue]
> I believe Forms!TabMainSpouse!TabSpouseAddresses.SetFocus is very[/color]
I just tried your suggestion, and some variations of, but no luck I'm
afraid.
Sorry for any confusion: essentially the Main form is called frmMain
- on this form, I have two tabbed forms. The first tab manages some
general client info, and has two pages.
This tab form is called, TabMainClient; the first page is called
TabClient, and the second page is called TabClientAddresses. On the
second page, I have a subform called sfrmClientAddresses, which has two
tabbed pages. The first page is TabClientCivic, and the second,
TabClientMailing.
The same setup is used for the second tab on my main form, but Spouse
is substituted for Client:
TabMainSpouse
- TabSpouse (1st tab)
- TabSpouseAddresses (2nd tab)
- sfrmSpouseAddresses
- TabSpouseCivic
- TabSpouseMailing
I hope this helps to clarify the setup, although I must admit it does
sound rather confusing, much easier visually then to explain verbally.
Cheers,
Dave | | | | re: A2003 - Tab to Tab Focus
In the OnChange of your TabClients control, put the following code:
Forms!frmMain.Form!TabControlName.Pages(TabClients .Value).SetFocus
Where (if I've got this down right) TabClients is a tab control in
sfrmClientAddresses and TabControlName is the name of a tab control on
sfrmClientSpouseAddresses. | | | | re: A2003 - Tab to Tab Focus
Sorry, just would not work...produced these error messages:
===========
Forms!frmMain.Form!TabSpouseAddresses.Pages(TabCli entAddresses.Value).SetFocus
Method or data method not found
===========
Forms!frmMain.Form!TabSpouseAddresses.Pages(TabCli entCivic.Value).SetFocus
Variable not defined
===========
I tried some variation, but no luck :-o(
Each compile error point to the (__ .Value) area
I'll try again in the AM
Thanks for your help!
Cheers,
Dave | | | | re: A2003 - Tab to Tab Focus
Is TabClientCivic a tab control? Or is it a TabPage? If it is a
TabPage, replace TabClientCivic with the name of the actual tab control
it sits on. | | | | re: A2003 - Tab to Tab Focus
Steve wrote:[color=blue]
> Is TabClientCivic a tab control? Or is it a TabPage? If it is a
> TabPage, replace TabClientCivic with the name of the actual tab control
> it sits on.[/color]
Main Form: frmMain
All the names indicated below are the Tab Names, and then each has a
Caption. The only controls names I see are the actual fields on the
tabs...were would I look for a Tab Control Name; when I click on each
tab I only see Name and Caption?
TabMainClient (Clients Tab Form)
- TabClient (1st Tab - Client Info - Caption = Client)
- TabClientAddresses (2nd Tab - Client Addresses, has subform w/Civic
Tab and Mailing Tab)
- sfrmClientAddresses (Subform)
- TabClientAddresses (Tab Form on Subform - Caption =
Addresses)
- TabClientCivic (1st Tab - Caption = Civic)
- TabClientMailing (2nd Tab - Caption = Mailing)
Same naming concept for the Spouses tabs:
TabMainSpouse (Spouses Tab Form)
- TabSpouse (1st Tab - Spouses Info)
- TabSpouseAddresses (2nd tab)
- sfrmSpouseAddresses (Subform)
- TabSpouseCivic (1st Tab)
- TabSpouseMailing 2nd Tab) | | | | re: A2003 - Tab to Tab Focus
All right, this is a bit hard to explain. TabSpouseCivic is a TabPage.
A TabPage sits on a Tab control. You can find out the name of the Tab
control your TabPage sits on by clicking the blank grey area to the
right of the second TabPage (TabSpouseMail) tab, where the caption is,
and going to View | Properties. The Properties box will display the
name of the Tab control. Once you have that name, use this syntax:
Forms!frmMain.Form!TabControlName.Pages(TabControl NameHERE.Value).SetFocus | | | | re: A2003 - Tab to Tab Focus
Hi Steve; I followed your instructions at tried the following, but the
following error message popped up..."Method or data method not found",
and when to the code...".Value".
Forms!frmMain.Form!TabMainSpouse.Pages(tabClient.V alue).SetFocus
and if I try it this way:
Forms!frmMain.Form!tabClient.Pages(TabMainSpouse.V alue).SetFocus
this is the error message: Error: Run-time error 438 - Object doesn't
support this object of method.
I'm wondering if this is worth it...long day :-o(
Dave | | | | re: A2003 - Tab to Tab Focus
I suspect that tabClient and TabMainSpouse are TabPages and not actual
tab controls (TabPages do not have a Value property). I think once you
find out the tab control names you'll be home free.
Suggestion #1: The default name for tab controls starts with "Ctl0" and
increments. So the first tab control you place on the form is Ctl0, the
second is Ctl1, third is Ctl2, etc. You could try substituting these
names for "tabClient" and "TabMainSpouse".
Suggestion #2 (more useful because you learn something): Follow these
steps:
1. Create a new form (Form1).
2. On that new form, draw a tab control object. It should appear with
two pages (Page 1 and Page 2) by default. Its name will be Ctl0 by
default. Make the tab control as wide as the form is.
3. At the top of the tab control, to the right of the tab bearing the
caption "Page 2", do you see the blank grey area? It is as tall as the
tabs and as wide as the form. It's kind of hard to see right away, but
it's there.
4. Click on that blank grey area. In the property sheet, look at the
Name property in the Other section. That is the name of your tab
control. RIght now, it should say Ctl0. If it says anything that
doesn't start with Ctl, you haven't selected the right part of the tab
control.
The hierarchy of a tab control with TabPages looks like this (use your
imagination):
---------------
TabPage1, TabPage2, etc
---------------
Tab control (holds all the TabPages)
----------------
So a tab control can have many TabPages, but a TabPage can have only
one tab control. Is that a bit more clear? Once you are able to see the
tab control as opposed to just the TabPages, I think it will make a lot
more sense to you. | | | | re: A2003 - Tab to Tab Focus
Steve,
You're the best; worked like a charm:
Forms!frmMain.Form!TabMainSpouse.Pages(TabMainClie nt.Value).SetFocus
Once I built a new tab and had a look-see, it all came together!
Your diligence, and most importantly, patience's, is greatly
appreciated.
All the best!!
Dave | | | | re: A2003 - Tab to Tab Focus
Dave, I'm glad it worked out for you. Remember that the .Value property
of a tab control always refers to the (0-based) index of the tab that
is currently being displayed. |  | Similar Microsoft Access / VBA bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,358 network members.
|