My Assistant
![]() ![]() |
|
|
May 17 2011, 10:37 AM
Post
#1
|
|
|
UtterAccess VIP Posts: 8,549 From: Dunbar,Scotland |
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?? |
|
|
|
May 17 2011, 11:03 AM
Post
#2
|
|
|
UtterAccess VIP Posts: 4,230 From: Columbus, OH USA |
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, |
|
|
|
May 17 2011, 11:03 AM
Post
#3
|
|
|
UtterAccess VIP Posts: 1,857 From: BC, Canada |
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 |
|
|
|
May 17 2011, 11:10 AM
Post
#4
|
|
|
UtterAccess VIP Posts: 8,549 From: Dunbar,Scotland |
Hi JD
My spelling mistake corrected but now get a runtime error 2465 Cannot fine the field frmClientsPhysicianAssessmentSubform |
|
|
|
May 17 2011, 11:12 AM
Post
#5
|
|
|
UtterAccess VIP Posts: 8,549 From: Dunbar,Scotland |
Hi Mike
How would I reference the Page Index on the subform?? |
|
|
|
May 17 2011, 11:12 AM
Post
#6
|
|
|
UtterAccess VIP Posts: 1,857 From: BC, Canada |
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 |
|
|
|
May 17 2011, 11:19 AM
Post
#7
|
|
|
UtterAccess VIP Posts: 7,646 From: South coast, England |
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 |
|
|
|
May 17 2011, 10:43 PM
Post
#8
|
|
|
UtterAccess VIP Posts: 18,427 From: Oklahoma City, Oklahoma |
This might help you with learning how to work with a tab control's pages: Wizard Form template
|
|
|
|
May 18 2011, 11:40 AM
Post
#9
|
|
|
UtterAccess VIP Posts: 8,549 From: Dunbar,Scotland |
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 |
|
|
|
May 18 2011, 11:41 AM
Post
#10
|
|
|
UtterAccess VIP Posts: 8,549 From: Dunbar,Scotland |
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 |
|
|
|
May 18 2011, 11:41 AM
Post
#11
|
|
|
UtterAccess VIP Posts: 8,549 From: Dunbar,Scotland |
Hi Boyd
Many thanks for the info |
|
|
|
May 18 2011, 12:11 PM
Post
#12
|
|
|
UtterAccess VIP Posts: 18,427 From: Oklahoma City, Oklahoma |
Mike,
You're welcome. Hope you found it useful. |
|
|
|
May 18 2011, 03:05 PM
Post
#13
|
|
|
UtterAccess VIP Posts: 7,646 From: South coast, England |
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 |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 18th June 2013 - 03:43 PM |