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

Tab control.. hierarchies and the like.

P: n/a
Hi,

Just trying to get my head around tab controls, is there anywhere which
would describe the structure of how they work? I seem to be ok so far,
being able to check which page I'm on etc... but I'm at a loss when
trying to access controls inside the tabs.

If I try to access the form directly ([forms]!...etc.) I get an error
that the form can't be found. I'm not sure how I can use parent/child
relationships to get at the (sub)forms which are on the tabs... any clues?

Also, which (if any) events are ran when changing between tabs? I know
the tab change event is one, but do any of the subforms (on the tab
page) have any events which occur, such as focus/load/open/activate?

Any help would be greatly appreciated!
Cheers,
Chris
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

I'm using a tab control so let me show you some of the code and maybe this
will help.

I have a main form: frmPatient and a subform: subformPatientVisit. On the
subform I have a
tab control called: TabCtlVisit.

frmPatient's recordsource is tblDemographics, primary key DemoID.
subform's recordsource is tblVisit, primary key VisitID, foreign key DemoID.
So in the properties dialog for the subform: Link Child Fields/Link Master
Fields is set
to DemoID.

I will put subforms on the tabbed pages and they will be child tables of the
Visit table,
e.g. for the patient's Echo test, primary key EchoID, foreign key VisitID
and set the
Link Child Fields/Link Master Fields to VisitID.

I currently have this code in place to access the controls on the tab
control:

To move from the main form to a combobox on the subform:
Me!subformPatientVisit.SetFocus
Me!subformPatientVisit.Form!cboVisit.SetFocus

To move from the main form to the first page of the tab control in the
subform:
Me!subformPatientVisit.SetFocus
Me!subformPatientVisit.Form!TabCtlVisit.Pages(0).S etFocus

To move to a specific control on the tabbed page (I needed all the lines of
code to make
this work...)

Me!subformPatientVisit.SetFocus
Me!subformPatientVisit.Form!TabCtlVisit.Pages(0).S etFocus

Me!subformPatientVisit.Form!TabCtlVisit.Pages(0).C ontrols("VisitDt").SetFocu
s

Look at the properties dialog for the subform - it has all the events any
form would have.

HTH -Linda
"Not Me" <no**********@da.com.uk.hk.org> wrote in message
news:co**********@ucsnew1.ncl.ac.uk...
Hi,

Just trying to get my head around tab controls, is there anywhere which
would describe the structure of how they work? I seem to be ok so far,
being able to check which page I'm on etc... but I'm at a loss when
trying to access controls inside the tabs.

If I try to access the form directly ([forms]!...etc.) I get an error
that the form can't be found. I'm not sure how I can use parent/child
relationships to get at the (sub)forms which are on the tabs... any clues?

Also, which (if any) events are ran when changing between tabs? I know
the tab change event is one, but do any of the subforms (on the tab
page) have any events which occur, such as focus/load/open/activate?

Any help would be greatly appreciated!
Cheers,
Chris

Nov 13 '05 #2

P: n/a
Squirrel wrote:
Hi,

I'm using a tab control so let me show you some of the code and maybe this
will help.

I have a main form: frmPatient and a subform: subformPatientVisit. On the
subform I have a
tab control called: TabCtlVisit.

frmPatient's recordsource is tblDemographics, primary key DemoID.
subform's recordsource is tblVisit, primary key VisitID, foreign key DemoID.
So in the properties dialog for the subform: Link Child Fields/Link Master
Fields is set
to DemoID.

I will put subforms on the tabbed pages and they will be child tables of the
Visit table,
e.g. for the patient's Echo test, primary key EchoID, foreign key VisitID
and set the
Link Child Fields/Link Master Fields to VisitID.

I currently have this code in place to access the controls on the tab
control:

To move from the main form to a combobox on the subform:
Me!subformPatientVisit.SetFocus
Me!subformPatientVisit.Form!cboVisit.SetFocus

To move from the main form to the first page of the tab control in the
subform:
Me!subformPatientVisit.SetFocus
Me!subformPatientVisit.Form!TabCtlVisit.Pages(0).S etFocus

To move to a specific control on the tabbed page (I needed all the lines of
code to make
this work...)

Me!subformPatientVisit.SetFocus
Me!subformPatientVisit.Form!TabCtlVisit.Pages(0).S etFocus

Me!subformPatientVisit.Form!TabCtlVisit.Pages(0).C ontrols("VisitDt").SetFocu
s

Look at the properties dialog for the subform - it has all the events any
form would have.

HTH -Linda


Thanks for all that linda, I think my understanding is improving.. tho
I'll give it a few more reads over just to be sure :)

Cheers,
Chris
Nov 13 '05 #3

P: n/a
Linda,
Correct me if I am wrong, but I believe you are referring to a Tab Control
set on a Subform on the parent form... which is a level deeper than the
current
question Chris posed.
I believe Chris has a subform on a Tab control on the parent form...
To reference any control on a tab control, just reference the control as if
there were no tab control.
Say I had a field "txtUserPref" on Tab Page 2.
From within the form I would use:
Me!txtUserPref
From another form or other code module:
Forms!frmMyForm!txtUserPref
The Tab is strictly a "visible" layout control, and does not affect
hierarchy. Although you may access controls by also referrencing their page,
you don't have to.
To reference a control on Subform on a Tab control:
Me!MySubform.Form!txtUserPref
or
Forms!frmMyForm!MySubform.Form!txtUserPref

Remember that Subforms are accessed by the name you gave the Subform
control, NOT by the name of the form that resides in the Subform control.
The control does not have to be on the visible Tab Page to be manipulated.

HTH.
~ Duane Phillips.
"Squirrel" <wi*****@covad.net> wrote in message
news:b8***************************@msgid.meganewss ervers.com...
Hi,

I'm using a tab control so let me show you some of the code and maybe this
will help.

I have a main form: frmPatient and a subform: subformPatientVisit. On the
subform I have a
tab control called: TabCtlVisit.

frmPatient's recordsource is tblDemographics, primary key DemoID.
subform's recordsource is tblVisit, primary key VisitID, foreign key
DemoID.
So in the properties dialog for the subform: Link Child Fields/Link Master
Fields is set
to DemoID.

I will put subforms on the tabbed pages and they will be child tables of
the
Visit table,
e.g. for the patient's Echo test, primary key EchoID, foreign key VisitID
and set the
Link Child Fields/Link Master Fields to VisitID.

I currently have this code in place to access the controls on the tab
control:

To move from the main form to a combobox on the subform:
Me!subformPatientVisit.SetFocus
Me!subformPatientVisit.Form!cboVisit.SetFocus

To move from the main form to the first page of the tab control in the
subform:
Me!subformPatientVisit.SetFocus
Me!subformPatientVisit.Form!TabCtlVisit.Pages(0).S etFocus

To move to a specific control on the tabbed page (I needed all the lines
of
code to make
this work...)

Me!subformPatientVisit.SetFocus
Me!subformPatientVisit.Form!TabCtlVisit.Pages(0).S etFocus

Me!subformPatientVisit.Form!TabCtlVisit.Pages(0).C ontrols("VisitDt").SetFocu
s

Look at the properties dialog for the subform - it has all the events any
form would have.

HTH -Linda
"Not Me" <no**********@da.com.uk.hk.org> wrote in message
news:co**********@ucsnew1.ncl.ac.uk...
Hi,

Just trying to get my head around tab controls, is there anywhere which
would describe the structure of how they work? I seem to be ok so far,
being able to check which page I'm on etc... but I'm at a loss when
trying to access controls inside the tabs.

If I try to access the form directly ([forms]!...etc.) I get an error
that the form can't be found. I'm not sure how I can use parent/child
relationships to get at the (sub)forms which are on the tabs... any
clues?

Also, which (if any) events are ran when changing between tabs? I know
the tab change event is one, but do any of the subforms (on the tab
page) have any events which occur, such as focus/load/open/activate?

Any help would be greatly appreciated!
Cheers,
Chris



Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.