Form Design Recommendation Tab and subforms

G

Gordzilla

I in the process of designing a form that needs to have a subform on it.
In the subform there are various items but one field represents one of 5
categories.
I need to achieve a method of displaying 5 subforms that display only the
detail records for each category.
I thought two methods:
One would be to use a tabcontrol with a copy of the subform on each page or
having one subform with an option group in the header that allows the user to
select the category to display.
Any recommendations on which way to go or alternative suggestions


Gordzilla
 
D

Dale Fye

However you decide to do it, I'd recommend that you consider only having a
single subform, and changing that controls ControlSource based on whichever
option group or tab is selected. If you've not worked with tab controls,
your best bet is to look at the tabs change event.

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
G

Gordzilla

I went the Tab route, but I can't quite get it to work
The tab control has 4 pages on it labelled A,B,R, and Z
On each page is a copy of the subform

The recordsource for the subform is :

SELECT tblSysRisk.Parent_ID, tblSysRisk.Manager, tblSysRisk.P_Before,
tblSysRisk.C_Before, tblSysRisk.P_After, tblSysRisk.C_After
FROM tblSysRisk
WHERE (((tblSysRisk.Manager)=[Forms]![frmDetails]![txtManager]))
ORDER BY tblSysRisk.Parent_ID, tblSysRisk.Manager;

frmDetails is the main form and txtManager is an unbound hidden textbox on
it with the value that matches the captions of each page.
Did the hidden text box method because I couldn't figure out how to get the
Page Caption values.

On change event has the following code

Private Sub TabCtlRisk_Change()
Me.fsubRiskAssesment.Requery
Select Case Me.TabCtlRisk.Value
Case 0
Me.txtManager = "A"
Case 1
Me.txtManager = "B"
Case 3
Me.txtManager = "R"
Case 4
Me.txtManager = "Z"
End Select
Forms!frmDetails![fsubRiskAssesment].Form.Requery
End Sub

The only way I get any of the child records to appear is if I remove the
where clause from the recordsource.

Where am I going wrong?

Gordzilla
 
D

Dale Fye

Gordzilla,

Did you remove all of the extra subforms? I don't know what other
information you have on the tab controls, besides the subform, but if there
is nothing in the tab controls but the 4 subforms, then I would delete all
four of the subforms. I would then create a new subform (create it on the
main form and then drag it over the subform). If you do it this way, you
only need the one subform, and it will float over the tab control and be
visible regardless of which tab is selected.

In your code, you used:

Forms!frmDetails![fsubRiskAssessment].Form.Requery

Is fsubRiskAssessment the name of the subform (when you look at it in design
view) or the name of the subform control on frmDetails? What should go in
there is the name of the subform CONTROL, not the form.

Hope this helps.

Dale


Gordzilla said:
I went the Tab route, but I can't quite get it to work
The tab control has 4 pages on it labelled A,B,R, and Z
On each page is a copy of the subform

The recordsource for the subform is :

SELECT tblSysRisk.Parent_ID, tblSysRisk.Manager, tblSysRisk.P_Before,
tblSysRisk.C_Before, tblSysRisk.P_After, tblSysRisk.C_After
FROM tblSysRisk
WHERE (((tblSysRisk.Manager)=[Forms]![frmDetails]![txtManager]))
ORDER BY tblSysRisk.Parent_ID, tblSysRisk.Manager;

frmDetails is the main form and txtManager is an unbound hidden textbox on
it with the value that matches the captions of each page.
Did the hidden text box method because I couldn't figure out how to get
the
Page Caption values.

On change event has the following code

Private Sub TabCtlRisk_Change()
Me.fsubRiskAssesment.Requery
Select Case Me.TabCtlRisk.Value
Case 0
Me.txtManager = "A"
Case 1
Me.txtManager = "B"
Case 3
Me.txtManager = "R"
Case 4
Me.txtManager = "Z"
End Select
Forms!frmDetails![fsubRiskAssesment].Form.Requery
End Sub

The only way I get any of the child records to appear is if I remove the
where clause from the recordsource.

Where am I going wrong?

Gordzilla

Dale Fye said:
However you decide to do it, I'd recommend that you consider only having
a
single subform, and changing that controls ControlSource based on
whichever
option group or tab is selected. If you've not worked with tab controls,
your best bet is to look at the tabs change event.

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
G

Gordzilla

Brilliant,

Worked like a charm, never would have thought about floating the subform
over the tab control!.

Gordzilla

Dale Fye said:
Gordzilla,

Did you remove all of the extra subforms? I don't know what other
information you have on the tab controls, besides the subform, but if there
is nothing in the tab controls but the 4 subforms, then I would delete all
four of the subforms. I would then create a new subform (create it on the
main form and then drag it over the subform). If you do it this way, you
only need the one subform, and it will float over the tab control and be
visible regardless of which tab is selected.

In your code, you used:

Forms!frmDetails![fsubRiskAssessment].Form.Requery

Is fsubRiskAssessment the name of the subform (when you look at it in design
view) or the name of the subform control on frmDetails? What should go in
there is the name of the subform CONTROL, not the form.

Hope this helps.

Dale


Gordzilla said:
I went the Tab route, but I can't quite get it to work
The tab control has 4 pages on it labelled A,B,R, and Z
On each page is a copy of the subform

The recordsource for the subform is :

SELECT tblSysRisk.Parent_ID, tblSysRisk.Manager, tblSysRisk.P_Before,
tblSysRisk.C_Before, tblSysRisk.P_After, tblSysRisk.C_After
FROM tblSysRisk
WHERE (((tblSysRisk.Manager)=[Forms]![frmDetails]![txtManager]))
ORDER BY tblSysRisk.Parent_ID, tblSysRisk.Manager;

frmDetails is the main form and txtManager is an unbound hidden textbox on
it with the value that matches the captions of each page.
Did the hidden text box method because I couldn't figure out how to get
the
Page Caption values.

On change event has the following code

Private Sub TabCtlRisk_Change()
Me.fsubRiskAssesment.Requery
Select Case Me.TabCtlRisk.Value
Case 0
Me.txtManager = "A"
Case 1
Me.txtManager = "B"
Case 3
Me.txtManager = "R"
Case 4
Me.txtManager = "Z"
End Select
Forms!frmDetails![fsubRiskAssesment].Form.Requery
End Sub

The only way I get any of the child records to appear is if I remove the
where clause from the recordsource.

Where am I going wrong?

Gordzilla

Dale Fye said:
However you decide to do it, I'd recommend that you consider only having
a
single subform, and changing that controls ControlSource based on
whichever
option group or tab is selected. If you've not worked with tab controls,
your best bet is to look at the tabs change event.

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



:

I in the process of designing a form that needs to have a subform on
it.
In the subform there are various items but one field represents one of
5
categories.
I need to achieve a method of displaying 5 subforms that display only
the
detail records for each category.
I thought two methods:
One would be to use a tabcontrol with a copy of the subform on each
page or
having one subform with an option group in the header that allows the
user to
select the category to display.
Any recommendations on which way to go or alternative suggestions


Gordzilla
 

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