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

A2003 - Tab to Tab Focus

P: n/a
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.



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

Jan 4 '06 #1
Share this Question
Share on Google+
11 Replies

P: n/a
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?

Jan 4 '06 #2

P: n/a
Steve wrote:
I believe Forms!TabMainSpouse!TabSpouseAddresses.SetFocus is very

I just tried your suggestion, and some variations of, but no luck I'm

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,

The same setup is used for the second tab on my main form, but Spouse
is substituted for Client:

- 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.



Jan 4 '06 #3

P: n/a
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

Jan 4 '06 #4

P: n/a
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!



Jan 5 '06 #5

P: n/a
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.

Jan 5 '06 #6

P: n/a
Steve wrote:
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.

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 =
- 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)

Jan 5 '06 #7

P: n/a
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

Jan 5 '06 #8

P: n/a
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(


Jan 5 '06 #9

P: n/a
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
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

The hierarchy of a tab control with TabPages looks like this (use your

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.

Jan 5 '06 #10

P: n/a

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

All the best!!


Jan 5 '06 #11

P: n/a
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.

Jan 6 '06 #12

This discussion thread is closed

Replies have been disabled for this discussion.