Hi Fry
I would use above soln if all forms are exactly identical in terms of fields that are being displayed and updated and layout is the same. Just thought I'd throw in another alternative, and one that works great, especially if you do have uniquely different subforms depending on house...
1. Make subform names conform to a naming convention
You can either store the full name of the subform in the Combobox for the home, or one thing I've done is controled the naming of my subforms to match a code/key field identifying the home. For example
attendance data for Home 1 (A Unique identifier = H1) --> fsubAttendH1
attendance data for Home 2 (A Unique identifier = H2) --> fsubAttendH2
... etc
2, Create Main form (ie frmMain) with a subform control that has been assigned a generic Name property (ie fsubChild)
3. Add your Home selection combo to the Main (frmMain) form
4. Use the Home selection combobox's After Update event to set the subforms's SourceObject property. For example, let's say the unique code for the home (ie H1, H2, H3) is in Column(0). You could use something like
/untested code
Private Sub cboPickHouse_AfterUpdate()
Dim strSubFrmName As String
strSubFrmName = "fsubAttend" & Me!cboPickHouse.Column(0)
Me!fsubChild.SourceObject = strSubFrmName
'Following not manditory, but I like to set the focus in the subform
Me!fsubChild.SetFocus
End Sub
5. Remember that the subform is loaded before the main form, so you may want a default there.
Hope this helps,
RandomElle
Access 2003
Windows XP
I have a form that is for tracking attendance at programs.
the main form is the program information, and the sub form is the attendance information.
I have 5 homes and need to switch between each home at any given time. Currently i use a tab form with 5 subforms attached filtering the attendance data for each home.
What i wish to do is select a home from a combo/list box and have 1 subform show me the data for that home. I really hate having 5 subforms that essentially do the exact same thing
If any one can help that would be great