mike60smart
May 17 2011, 10:37 AM
Hi Everyone
I have the following MainForm / SubForm ? Tabbed Control layout:-
Main Form - frmPhysicianAssessments
Subform1 - frmPhysicianAssessmentsDate
Subform2 - frmClientAssessmentSection subform
On this subform I have a Combobox named “cboSection”
Tabbed Control with 6 Subforms which are linked to frmClientAssessmentSection subform:-
Each subform is on Page Index 0 through to 5
What I would like to have happen is that on the After Update of cboSection display the corresponding Subform on the Tabbed Control
When I try this :-
Private Sub cboSection_AfterUpdate()
If Me.cboSection = 1 Then
Me.frmClientsPhycicianAssessment_Subform.Visible = True
Else
Me.frmClientsPhycicianAssessment_Subform.Visible = False
End If
End Sub
I get the following error:-
Compile error
Method or data member not found
Any suggestions??
J.D.
May 17 2011, 11:03 AM
2 quick observations:
1. Me.frmClientsPhycicianAssessment_Subform looks to be misspelled? in your if then else statement try
Me.frmClientsPhysicianAssessment_Subform
2. you didn't mention this subform in your description. So even spelled correctly, it may not be found.
If this solves your problem wonderful, if it doesn't resolve completely, keep posting details...
Hope this helps,
MikeLyons
May 17 2011, 11:03 AM
QUOTE (mike60smart @ May 17 2011, 04:37 PM)

Each subform is on Page Index 0 through to 5
What I would like to have happen is that on the After Update of cboSection display the corresponding Subform on the Tabbed Control
When I try this :-
Private Sub cboSection_AfterUpdate()
If Me.cboSection = 1 Then
Me.frmClientsPhycicianAssessment_Subform.Visible = True
Else
Me.frmClientsPhycicianAssessment_Subform.Visible = False
End If
End Sub
I get the following error:-
Compile error
Method or data member not found
Any suggestions??
Since each subform is on its own tab you don't need to toggle the Visible property -- leave it visible, but instead you want to change the current value of the tab control to the index of the tab you want displayed.
Mike
mike60smart
May 17 2011, 11:10 AM
Hi JD
My spelling mistake corrected but now get a runtime error 2465
Cannot fine the field frmClientsPhysicianAssessmentSubform
mike60smart
May 17 2011, 11:12 AM
Hi Mike
How would I reference the Page Index on the subform??
MikeLyons
May 17 2011, 11:12 AM
QUOTE (mike60smart @ May 17 2011, 05:10 PM)

Hi JD
My spelling mistake corrected but now get a runtime error 2465
Cannot fine the field frmClientsPhysicianAssessmentSubform
Make sure you reference the name of the subform container control on the form, which may or may not be the name of the actual form object you used.
Mike
pere_de_chipstick
May 17 2011, 11:19 AM
Hi Mike
A little confused by what you are trying to do; are you trying to hide a subform on one of the tab control pages, or the tab page that the sub form sits on.
To hide the page on a tab control you would need e.g.
Me.TabControlPageName.Visible = False
Where TabControlPageName is the name property of the current tab page when clicked on in design view, (NOT the name of the tab control)
If you want to hide a sub form then
Me.SubFormName.Visible = False
will hide the sub form but not the page of the tab control it sits on.
hth
HiTechCoach
May 17 2011, 10:43 PM
This might help you with learning how to work with a tab control's pages:
Wizard Form template
mike60smart
May 18 2011, 11:40 AM
Hi Bernie
You are right I confused myself
I have now got rid of the tabbed Control and just have a number of Subforms and they work fine using the following on
the after Update of the combobox:-
If Me.cboSection = 1 Then
Forms!frmPhysicianAssessments!frmClientsPhysicianAssessment1Subform.Visible = True
Else
Forms!frmPhysicianAssessments!frmClientsPhysicianAssessment1Subform.Visible = False
End If
Many thanks for your input
mike60smart
May 18 2011, 11:41 AM
Hi Mike
Many thanks for your input I have now resolved the issue using this
If Me.cboSection = 1 Then
Forms!frmPhysicianAssessments!frmClientsPhysicianAssessment1Subform.Visible = True
Else
Forms!frmPhysicianAssessments!frmClientsPhysicianAssessment1Subform.Visible = False
End If
mike60smart
May 18 2011, 11:41 AM
Hi Boyd
Many thanks for the info
HiTechCoach
May 18 2011, 12:11 PM
Mike,
You're welcome. Hope you found it useful.
pere_de_chipstick
May 18 2011, 03:05 PM
Hi Mike
Glad you got it sorted.
Just a suggestion, - if you are hiding/unhiding your subforms and some subforms don't need to be visible at the same time, then you could reduce the number of subforms on your form and change the subform source object rather than make them Visible/Invisible, this would reduce the number of subforms you need on your form and potentially free up some real estate.
e.g.
CODE
Select case Me.cboSection
Case 1
Forms!frmPhysicianAssessments!frmClientsPhysicianAssessment1Subform.SourceObject = "SubFormName1"
Case 2
Forms!frmPhysicianAssessments!frmClientsPhysicianAssessment1Subform.SourceObject = "SubFormName2"
Case 3
Forms!frmPhysicianAssessments!frmClientsPhysicianAssessment1Subform.SourceObject = "SubFormName3"
End Select
hth
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.