tab controls setting focus

G

Guest

Can someone help please?

I have forms named [frmClient], [frmJob], [sfrmVisits], [ssfrmVisitsBC].

My user is usually viewing [frmClient] which has a subform [sfrmVisits] on a
TabControl. They always see the client data and the jobs for that client
(using navigation). Also on that TabControl is a nested TabControl with
subform [ssfrmVisitsBC] placed on each tab, to display the service associated
with a given job. The [cboService] field is resident on [frmJob].

Here's my issue: as the user views a client and navigates through the
client's jobs, the nested TabControl should change focus dependent on
[cboService]. I have OnCurrent code in [frmJob ] that IfThenElse queries
[cboService] and changes focus on the nested TabControl. (In theory, anyway!)

I have used every combination of Forms!, Me!, and hierarchy, etc to point to
nested TabControl -- without success.

Can anyone point me in the right direction? Or at least provide code with
explanation?

Thanks in advance,
Chris
 
S

strive4peace

Selecting nested subforms, Subform Control vs Subform, Properties Window
---


Hi Chris,

setting the focus is just a matter of "drilling down" to what you want...

assuming focus is already on the main form...
(if not, DoCmd.OpenForm or DoCmd.SelectObject)

set focus to first-level subform control

1. me.subform_controlname.setfocus

then, within that control, set it to the next subform

2. me.subform_controlname.form.subformnested_controlname.setfocus

the, if you have more levels of subforms, continue in the same manner.

Finally, you can set the focus to a particular control...

3. me.subform_controlname.form.
NestedSubform_controlname.form.controlname.setfocus

Each time, you will refer to the NAME property of the respective
controls -- not SourceObject or ControlSource

Tabs make no difference in the reference, they are just used for organizing

*** Subform Control vs Subform: The Difference between a Subform Control
and a Subform ***

The first click on a subform control puts handles* around the subform
object.
*black squares in the corners and the middle of each size -- resizing
handles

The subform object has properties such as

Name
SourceObject
LinkMasterFields
LinkChildFields
Visible
Locked
Left
Top
Width
Height

the subform control is just a container for the subform.

the subform itself is an independent form -- you can open it directly
from the database window and it has the same properties of the main
form. It is only called a subform because of the way it is being used.

To summarize, when you are in the design view of the main form, the
first click on the subform is the subform control -- you will see the
handles around the edges -- and the second click gets you INTO it -- you
will see a black square where the rulers intersect in the upper left of
the "form" you are "in" (and this is the same as if you went to the
design directly)

me.subform.controlname --> the subform control
me.subform.controlname.form --> the form inside the subform control

~~~~ turn on Properties window ~~~~

When you are in the design view, turn on/off the Properties window -->

1. from menu: View, Properties
OR
2. right-click and choose Properties from the shortcut menu

and then click on various objects. The properties window changes as you
change what is selected. If you have multiple objects selected, the
values for the properties they have in common will be displayed


Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*


Can someone help please?

I have forms named [frmClient], [frmJob], [sfrmVisits], [ssfrmVisitsBC].

My user is usually viewing [frmClient] which has a subform [sfrmVisits] on a
TabControl. They always see the client data and the jobs for that client
(using navigation). Also on that TabControl is a nested TabControl with
subform [ssfrmVisitsBC] placed on each tab, to display the service associated
with a given job. The [cboService] field is resident on [frmJob].

Here's my issue: as the user views a client and navigates through the
client's jobs, the nested TabControl should change focus dependent on
[cboService]. I have OnCurrent code in [frmJob ] that IfThenElse queries
[cboService] and changes focus on the nested TabControl. (In theory, anyway!)

I have used every combination of Forms!, Me!, and hierarchy, etc to point to
nested TabControl -- without success.

Can anyone point me in the right direction? Or at least provide code with
explanation?

Thanks in advance,
Chris
 
G

Guest

Thank you, thank you, thank you!

That was a most informative post and solved my dilemma -- the immediate and
probably many future.
--
Thanks so much for your help and detailed explanation,
Chris


strive4peace said:
Selecting nested subforms, Subform Control vs Subform, Properties Window
---


Hi Chris,

setting the focus is just a matter of "drilling down" to what you want...

assuming focus is already on the main form...
(if not, DoCmd.OpenForm or DoCmd.SelectObject)

set focus to first-level subform control

1. me.subform_controlname.setfocus

then, within that control, set it to the next subform

2. me.subform_controlname.form.subformnested_controlname.setfocus

the, if you have more levels of subforms, continue in the same manner.

Finally, you can set the focus to a particular control...

3. me.subform_controlname.form.
NestedSubform_controlname.form.controlname.setfocus

Each time, you will refer to the NAME property of the respective
controls -- not SourceObject or ControlSource

Tabs make no difference in the reference, they are just used for organizing

*** Subform Control vs Subform: The Difference between a Subform Control
and a Subform ***

The first click on a subform control puts handles* around the subform
object.
*black squares in the corners and the middle of each size -- resizing
handles

The subform object has properties such as

Name
SourceObject
LinkMasterFields
LinkChildFields
Visible
Locked
Left
Top
Width
Height

the subform control is just a container for the subform.

the subform itself is an independent form -- you can open it directly
from the database window and it has the same properties of the main
form. It is only called a subform because of the way it is being used.

To summarize, when you are in the design view of the main form, the
first click on the subform is the subform control -- you will see the
handles around the edges -- and the second click gets you INTO it -- you
will see a black square where the rulers intersect in the upper left of
the "form" you are "in" (and this is the same as if you went to the
design directly)

me.subform.controlname --> the subform control
me.subform.controlname.form --> the form inside the subform control

~~~~ turn on Properties window ~~~~

When you are in the design view, turn on/off the Properties window -->

1. from menu: View, Properties
OR
2. right-click and choose Properties from the shortcut menu

and then click on various objects. The properties window changes as you
change what is selected. If you have multiple objects selected, the
values for the properties they have in common will be displayed


Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*


Can someone help please?

I have forms named [frmClient], [frmJob], [sfrmVisits], [ssfrmVisitsBC].

My user is usually viewing [frmClient] which has a subform [sfrmVisits] on a
TabControl. They always see the client data and the jobs for that client
(using navigation). Also on that TabControl is a nested TabControl with
subform [ssfrmVisitsBC] placed on each tab, to display the service associated
with a given job. The [cboService] field is resident on [frmJob].

Here's my issue: as the user views a client and navigates through the
client's jobs, the nested TabControl should change focus dependent on
[cboService]. I have OnCurrent code in [frmJob ] that IfThenElse queries
[cboService] and changes focus on the nested TabControl. (In theory, anyway!)

I have used every combination of Forms!, Me!, and hierarchy, etc to point to
nested TabControl -- without success.

Can anyone point me in the right direction? Or at least provide code with
explanation?

Thanks in advance,
Chris
 
S

strive4peace

you're welcome, Chris ;) happy to help

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top