473,509 Members | 2,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TAB CONTROL to load a FORM

I'm starting a new project. A Personnel System. I have considered
opening a single bound form to the main employee table. The user can
scroll the records to any individual. I would like to have a tab
control at the top of the form which would allow the user to select
(PERSONAL), (TRAINING),(DISIPLINARY),and (SICKLEAVE) Tabs. Each Tab
should open a FORM and display the relavant TABLE of records tied to
the Employee being viewed in the MainForm.

How do I get the Tab selected to load a (Form or SubForm Control) and
it's Table?
Can I, or should I close the Form/Table when leaving the selected Tab?

OR ... Should I just open multiple tables at startup, and make the
relevant fields available
in each Tab Page ?
ThankYou
Greg

Dec 10 '06 #1
3 4124
<Ap******@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
I'm starting a new project. A Personnel System. I have considered
opening a single bound form to the main employee table. The user can
scroll the records to any individual. I would like to have a tab
control at the top of the form which would allow the user to select
(PERSONAL), (TRAINING),(DISIPLINARY),and (SICKLEAVE) Tabs. Each Tab
should open a FORM and display the relavant TABLE of records tied to
the Employee being viewed in the MainForm.

How do I get the Tab selected to load a (Form or SubForm Control) and
it's Table?
Can I, or should I close the Form/Table when leaving the selected Tab?

OR ... Should I just open multiple tables at startup, and make the
relevant fields available
in each Tab Page ?
Tabs don't have their own tables. What you would do is create subforms for each
of those tables and place a subform onto each tab page. The standard mechanism
for a subform (MasterLink and ChildLink properties) is what will cause you to
see the records that are related to the main record.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Dec 10 '06 #2
well, you couldn't do it with a tab control, but you could use an option
group, with each button opening a separate form bound to one of the
"subordinate" tables - Personal, Training, Disciplinary, Sick Leave. you can
use a WHERE clause in the OpenForm action to filter the subordinate records
to match the current record in the main form.

you might want to consider keeping everything on one main form, though,
rather than opening separate "pop up" forms. consider the following setup:
create an unbound main form; i'll call it frmMain.
add a tab control with two tab pages in it.
add a subform control to each tab page; on page 1, i'll call the subform
control ChildEmployees, on page2, i'll call the subform control
ChildDetails.
add an unbound textbox control to the main form; i'll call it txtPK, and set
its' Visible property to No.
add an option group with five toggle buttons in it, to the main form; i'll
call it grpChoice.
set the first button's OptionValue property to 0, and its' Caption property
to Employees; set the second button's OptionValue property to 1, and its'
Caption property to Personal; set the third button's OptionValue to 2, and
its' Caption property to Training, and so on for the last two buttons.
set the option group's BorderStyle property to Transparent, and delete the
label attached to the option group control.

now create a new form, bound to tblEmployees, and set its' DefaultView to
ContinuousForms or Datasheet. i'll call the primary key field of
tblEmployees, EmpID.
i'll call the form frmEmployees.

create a new form for each of the subordinate tables - Personal, Training,
Disciplinary, Sick Leave.
each of the subordinate tables should already have a foreign key field in
it, that links it back to tblEmployees. i'll call those foreign keys
personal_EmpID, training_EmpID, disciplinary_EmpID, sickleave_EmpID.
i'll call the forms frmPersonal, frmTraining, frmDisciplinary, frmSickLeave.

okay, now we're ready to connect the dots:
open frmMain in design view.
on tab page1, select ChildEmployees, and set it's SourceObject property to
frmEmployees.
select txtPK, and set its' ControlSource property to

=[ChildEmployees].[Form]![EmpID]

on tab page2, select ChildDetails, and set its' LinkMasterFields property to
txtPK. select grpChoices, and create an event procedure on the Click event.
add the following code to the event procedure, as

Select Case Me!grpChoices
Case 1
Me!ChildDetails.SourceObject = "frmPersonal"
Me!ChildDetails.LinkChildFields = "personal_EmpID"
Case 2
Me!ChildDetails.SourceObject = "frmTraining"
Me!ChildDetails.LinkChildFields = "training_EmpID"
Case 3
Me!ChildDetails.SourceObject = "frmDisciplinary"
Me!ChildDetails.LinkChildFields = "disciplinary_EmpID"
Case 4
Me!ChildDetails.SourceObject = "frmSickLeave"
Me!ChildDetails.LinkChildFields = "sickleave_EmpID"
End Select

If Me!grpChoices = 0 Then
Me!TabCtl0 = 0
Else
Me!TabCtl0 = 1
End If

last but not least, set the tab control's BackStyle property to Transparent,
and Style property to None.

here's how it works. when you open frmMain, you see the employees subform
and the option group of toggle buttons. scroll down to whatever employee you
want to see details about, and click one of the four toggle buttons -
Personal, Training, etc. the employees subform "disappears" and the details
subform appears showing the records related to the employee you chose. click
another button and the subform changes to the newly selected detail
records - still for the same employee. to go back to the employee list,
click the Employees toggle button.

the advantage to this setup is that when frmMain opens, only one subform
loads - frmEmployees. this is quicker than loading five subforms. since the
user can only look at one subform at a time, there's no point in actually
having four additional subforms, one for each subordinate table. instead,
the subform control on the second tab page displays whichever subform is
loaded when a toggle button in the option group is clicked.

hth
<Ap******@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
I'm starting a new project. A Personnel System. I have considered
opening a single bound form to the main employee table. The user can
scroll the records to any individual. I would like to have a tab
control at the top of the form which would allow the user to select
(PERSONAL), (TRAINING),(DISIPLINARY),and (SICKLEAVE) Tabs. Each Tab
should open a FORM and display the relavant TABLE of records tied to
the Employee being viewed in the MainForm.

How do I get the Tab selected to load a (Form or SubForm Control) and
it's Table?
Can I, or should I close the Form/Table when leaving the selected Tab?

OR ... Should I just open multiple tables at startup, and make the
relevant fields available
in each Tab Page ?
ThankYou
Greg

Dec 10 '06 #3

Thankyou all for the great suggestions. I will test run a few and see
what works best for me. I have the added consideration of
(New/Edit/Del) buttons
that I want at the MainForm heading, nad some security features I need
to build in
which I should not be too complex. I'll simply enable/disable the tabs
based on user.
The New/Edit/Del issue may be a problem, since I want it in one place
(the heading)
but it has to work with the main form or subforms, whichever has the
focus.

Greg

Dec 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2483
by: David | last post by:
Ok. Can PHP control a form value directly? Eg. like the javascript "document.Form1.text01.value = "Y"". Eg. allow me to put a value into a form text field on page load. Either I missed this in...
1
2051
by: Marco Simone | last post by:
Hi, If someone can answer how to add calendar control on form, where you can choose date. I think there is Calendar control in ActiveX add in, but I don't know how to implement it. Thanks...
6
4115
by: MP | last post by:
Hello I want to have a public property (and Brows able) in one control, I use this code: public System.Windows.Forms.Form recordForm get { return _recordForm;} set {_recordForm = value;}
4
1598
by: Dan | last post by:
I am back yet again :) I am encountering an Exception that has me scratching my head. I have two forms. Form A launches Form B in response to the user clicking a button. The Constructor for Form...
0
1098
by: sridev | last post by:
i am new to ASP.NET with CSharp. I am having an application, Which has a web form as Home.aspx. In that page iloaded a user control web form (Insertclient.ascx) in the page load.Now i have a next...
1
1080
by: sridev | last post by:
i am new to ASP.NET with CSharp. I am having an application, Which has a web form as Home.aspx. In that page i loaded a user control web form (Insertclient.ascx) in the page load.Now i have a...
1
1668
by: MLH | last post by:
I thought it was DoCmd.GoToPage - but that doesn't work for Tab Controls, it seems - only for forms with page breaks in them. Anybody know Syntax form moving from page-to-page (actually,...
2
2866
by: MLH | last post by:
A97 Am having difficulty displaying graph in Form View that I see fine in graph control on form opened in design view. I know I'm doing something wrong. If I open the form in design view - I...
1
1413
by: Wanjun Yu | last post by:
In C#, what control or form can display HTML? I know in Visual C++, the CHtmlView is the one, but I can't seem to find the couterpart in C#. Thanks. WJ
8
7544
by: Mitch5713 | last post by:
I've got tthree forms at start up splashscreen- works fine however how do i set the time delay so it stays on the window longer,, shows longer?? Loginscreen- works fine, after the data processing...
0
7234
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7136
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
7412
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7069
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...
1
5060
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...
0
3216
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3203
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
441
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.