Hi, your video is incredibly useful. I don't know why you haven't made any video in the last two years. If possible, could you please post more? Thank you!
This is great and really useful, however now I have the event control on the tab control, everytime a tab is clicked everything in the details section re-draws. Is there a way to stop this?
What if I have more than one subform on a tab? I don't know anything about coding in code builder...I'm guessing this is VBA you're using? Could you demonstrate what the code would look like for, say 3 subforms on one tab?
@@JohnSmith-th5zw It's been a few years since I've worked on the database I was asking about. I think the switch/case statement would be structured something like the following: Select Case Me.tabctlEval.Value Case 0 Me.SubformContainer1.SourceObject = "subfrmTab1" Me.SubformContainer2.SourceObject = "subfrmTab2" Me.SubformContainer3.SourceObject = "subfrmTab3" Case 1 Me.SubformContainer1.SourceObject = "subfrmTab4" Me.SubformContainer2.SourceObject = "subfrmTab5" Me.SubformContainer3.SourceObject = "subfrmTab6" Case 3 Me.SubformContainer1.SourceObject = "subfrmTab7" Basically, you're saying, whatever tab number I'm clicking on, I want you to show these subforms in these subcontainers. The above would be an example of if you wanted 3 subforms to show on the first 2 tabs, and then just one subform to show on the third tab. I think that would work...but not 100% sure. I ended up going a completely different route with my database structure.
When you design a form like this, where you can put different sub-forms in the same sub-form container, I think it breaks the normal way we link sub-forms to parent forms. Usually, you would use the Link Master and Child Fields settings in the property to grid to sync your forms. But I don't think this works if you switch out the sub-forms in the container. I use a function that gets the record key from somewhere on the parent form or a public variable, and I put that in the SQL (record source) that populates each sub-form that can go into that sub-form container. an example: "SELECT * FROM ReferralBackground WHERE EvaluationID=GetInitialEval(); " GetInitialEval is a public function that gets the primary key off of the parent form. I put this in the "Record Source" property of the form so it executes when the form is loaded to the sub-form container. Now if you are going to allow navigating to a different record on the parent form while the sub-form stays loaded, you'll need to put code in the parent form's "on current" event procedure that tells the sub-form to refresh itself - maybe requery. Or you can call a public function that is inside the sub-form that will cause it to refresh itself.
thanks for replying! I am trying to do as little coding as possible and found that using the relationships window to link the primary index of the parent table to a link field in child table does the job for me. I can see your way being more flexible, like if i were to want to have the option of changing the data source of the subform on the fly. l am using your subform container and isolated tab control method and love it!
haha, decided to ditch linking with relationships window after all. I tried using a query with the main form id as the criteria. The data synced fine as i changed records on the main form, I could see the data previously entered in my subform change too but when i tried to enter data it wouldnt stick..ie it wouldnt update the table. I ended up using objSubform.LinkMasterFields and objSubform.LinkChildFields to get everything working. I found a simple example of this here .....www.databasejournal.com/features/msaccess/article.php/3599781/MSAccess-Load-Subforms-Dynamically.htm
It didnt work for me! :( Private Sub form_Load() Me.TAB1.Value = 0 TAB1_change End Sub ---- Private Sub TAB1_change() Select Case Me.TAB1.Value Case 0 Me.SubCont.SourceObject = "00_Main-Menu" Case 1 Me.SubCont.SourceObject = "01_Project-List" Case 2 Me.SubCont.SourceObject = "02_Add-Project" Case 3 Me.SubCont.SourceObject = "03_Whiteboard" Case 4 Me.SubCont.SourceObject = "" Case 5 Me.SubCont.SourceObject = "" Case 6 Me.SubCont.SourceObject = "" Case 7 Me.SubCont.SourceObject = "" Case 8 Me.SubCont.SourceObject = "" End Select End Sub
Hi, your video is incredibly useful. I don't know why you haven't made any video in the last two years. If possible, could you please post more? Thank you!
I found your project and explanation very useful and easy to follow. much appreciated.
Nice approach between tab control with subforms,
Thank you for sharing
This is a incredibly useful alternative to setting up tab controls. Thank you!
Great. Can we use option group to open multiple sub forms like this?
Very efficient indeed! Great idea & thanks for sharing!
Thank you so much. I love your video so much.
I hope one day, you can make tutorial video about chart in access by VBA,can't you?
This is great and really useful, however now I have the event control on the tab control, everytime a tab is clicked everything in the details section re-draws. Is there a way to stop this?
The XML and VBA can no longer be found at the referenced page. Can you please provide them again? Thank you.
Great idea, and I thing it would be great only that we have Navigation Tab!
What if I have more than one subform on a tab? I don't know anything about coding in code builder...I'm guessing this is VBA you're using? Could you demonstrate what the code would look like for, say 3 subforms on one tab?
I have the same issue. Were you able to get the code you were asking for? If so, can you share it? Thanks
@@JohnSmith-th5zw It's been a few years since I've worked on the database I was asking about. I think the switch/case statement would be structured something like the following:
Select Case Me.tabctlEval.Value
Case 0
Me.SubformContainer1.SourceObject = "subfrmTab1"
Me.SubformContainer2.SourceObject = "subfrmTab2"
Me.SubformContainer3.SourceObject = "subfrmTab3"
Case 1
Me.SubformContainer1.SourceObject = "subfrmTab4"
Me.SubformContainer2.SourceObject = "subfrmTab5"
Me.SubformContainer3.SourceObject = "subfrmTab6"
Case 3
Me.SubformContainer1.SourceObject = "subfrmTab7"
Basically, you're saying, whatever tab number I'm clicking on, I want you to show these subforms in these subcontainers. The above would be an example of if you wanted 3 subforms to show on the first 2 tabs, and then just one subform to show on the third tab. I think that would work...but not 100% sure. I ended up going a completely different route with my database structure.
Brilliant!!!
I like this method,however my subform is not syncing with the parent as i change records in the parent. could you help with this?
thanks!
When you design a form like this, where you can put different sub-forms in the same sub-form container, I think it breaks the normal way we link sub-forms to parent forms. Usually, you would use the Link Master and Child Fields settings in the property to grid to sync your forms. But I don't think this works if you switch out the sub-forms in the container. I use a function that gets the record key from somewhere on the parent form or a public variable, and I put that in the SQL (record source) that populates each sub-form that can go into that sub-form container. an example: "SELECT * FROM ReferralBackground WHERE EvaluationID=GetInitialEval(); " GetInitialEval is a public function that gets the primary key off of the parent form. I put this in the "Record Source" property of the form so it executes when the form is loaded to the sub-form container. Now if you are going to allow navigating to a different record on the parent form while the sub-form stays loaded, you'll need to put code in the parent form's "on current" event procedure that tells the sub-form to refresh itself - maybe requery. Or you can call a public function that is inside the sub-form that will cause it to refresh itself.
thanks for replying! I am trying to do as little coding as possible and found that using the relationships window to link the primary index of the parent table to a link field in child table does the job for me. I can see your way being more flexible, like if i were to want to have the option of changing the data source of the subform on the fly. l am using your subform container and isolated tab control method and love it!
haha, decided to ditch linking with relationships window after all. I tried using a query with the main form id as the criteria. The data synced fine as i changed records on the main form, I could see the data previously entered in my subform change too but when i tried to enter data it wouldnt stick..ie it wouldnt update the table. I ended up using objSubform.LinkMasterFields and objSubform.LinkChildFields to get everything working. I found a simple example of this here .....www.databasejournal.com/features/msaccess/article.php/3599781/MSAccess-Load-Subforms-Dynamically.htm
Great tip! Thank you!
I asked chatGPT to fix me up something like this but couldn't do it.
Thanks
It didnt work for me! :(
Private Sub form_Load()
Me.TAB1.Value = 0
TAB1_change
End Sub
----
Private Sub TAB1_change()
Select Case Me.TAB1.Value
Case 0
Me.SubCont.SourceObject = "00_Main-Menu"
Case 1
Me.SubCont.SourceObject = "01_Project-List"
Case 2
Me.SubCont.SourceObject = "02_Add-Project"
Case 3
Me.SubCont.SourceObject = "03_Whiteboard"
Case 4
Me.SubCont.SourceObject = ""
Case 5
Me.SubCont.SourceObject = ""
Case 6
Me.SubCont.SourceObject = ""
Case 7
Me.SubCont.SourceObject = ""
Case 8
Me.SubCont.SourceObject = ""
End Select
End Sub
very low sound...
Your audio is terribly low!