J
johnlute
Access 2003/Win 2000.
I have lots of forms that use multiple subforms so I've placed them on
tab controls. The subforms are rather complex so Access tends to crap
out when trying to run a report with a form open.
I decided to experiment with loading/unloading subforms via the tab
control change event. I've got this which works just fine:
Private Sub TabCtrlAttributes_Change()
Select Case Me.TabCtrlAttributes
Case 1
Me.sfrmProfilesCodes.SourceObject = "sfrmProfilesCodes"
Case 2
Me.sfrmProfilesApprovals.SourceObject =
"sfrmProfilesApprovals"
Case 3
Me.sfrmProfilesAllergens.SourceObject =
"sfrmProfilesAllergens"
Case 4
Me.sfrmPKCGPhysicalAttributes.SourceObject =
"sfrmPKCGPhysicalAttributes"
Case 5
Me.sfrmPKCGMaterialAttributes.SourceObject =
"sfrmPKCGMaterialAttributes"
Case 6
Me.sfrmPKCGFinishingAttributes.SourceObject =
"sfrmPKCGFinishingAttributes"
Case 7
Me.sfrmPKCGPerformanceAttributes.SourceObject =
"sfrmPKCGPerformanceAttributes"
Case 8
Me.sfrmPKAdditionalAttributes.SourceObject =
"sfrmPKAdditionalAttributes"
Case 9
Me.sfrmPKProfilesQualifications.SourceObject =
"sfrmPKProfilesQualifications"
Case 10
Me.sfrmProfilesShipping.SourceObject =
"sfrmProfilesShipping"
Me.sfrmProfilesStorage.SourceObject =
"sfrmProfilesStorage"
Case 11
Me.sfrmProfilesLocationIDs.SourceObject =
"sfrmProfilesLocationIDs"
Me.sfrmPKProfilesSuppliers.SourceObject =
"sfrmPKProfilesSuppliers"
Case 12
Me.sfrmPKProfilesAssociations.SourceObject =
"sfrmPKProfilesAssociations"
Case 13
Me.sfrmProfilesAttachments.SourceObject =
"sfrmProfilesAttachments"
End Select
End Sub
The problem is that the subforms don't appear to unload when changing
to another tab. For example, when I first open the main form and do
nothing except run a report - the report runs fine. When I click on
all of the tabs and then run a report - the report craps out. When I
first click on a tab there's a slight delay before its subform opens.
When I click away from it and then back to it then there's no delay in
the subform loading. This coupled with the fact that the report craps
out is telling me that the subforms aren't unloading entirely.
How can I get the subforms to unload? Or is this not the problem?
Thanks for your help!
I have lots of forms that use multiple subforms so I've placed them on
tab controls. The subforms are rather complex so Access tends to crap
out when trying to run a report with a form open.
I decided to experiment with loading/unloading subforms via the tab
control change event. I've got this which works just fine:
Private Sub TabCtrlAttributes_Change()
Select Case Me.TabCtrlAttributes
Case 1
Me.sfrmProfilesCodes.SourceObject = "sfrmProfilesCodes"
Case 2
Me.sfrmProfilesApprovals.SourceObject =
"sfrmProfilesApprovals"
Case 3
Me.sfrmProfilesAllergens.SourceObject =
"sfrmProfilesAllergens"
Case 4
Me.sfrmPKCGPhysicalAttributes.SourceObject =
"sfrmPKCGPhysicalAttributes"
Case 5
Me.sfrmPKCGMaterialAttributes.SourceObject =
"sfrmPKCGMaterialAttributes"
Case 6
Me.sfrmPKCGFinishingAttributes.SourceObject =
"sfrmPKCGFinishingAttributes"
Case 7
Me.sfrmPKCGPerformanceAttributes.SourceObject =
"sfrmPKCGPerformanceAttributes"
Case 8
Me.sfrmPKAdditionalAttributes.SourceObject =
"sfrmPKAdditionalAttributes"
Case 9
Me.sfrmPKProfilesQualifications.SourceObject =
"sfrmPKProfilesQualifications"
Case 10
Me.sfrmProfilesShipping.SourceObject =
"sfrmProfilesShipping"
Me.sfrmProfilesStorage.SourceObject =
"sfrmProfilesStorage"
Case 11
Me.sfrmProfilesLocationIDs.SourceObject =
"sfrmProfilesLocationIDs"
Me.sfrmPKProfilesSuppliers.SourceObject =
"sfrmPKProfilesSuppliers"
Case 12
Me.sfrmPKProfilesAssociations.SourceObject =
"sfrmPKProfilesAssociations"
Case 13
Me.sfrmProfilesAttachments.SourceObject =
"sfrmProfilesAttachments"
End Select
End Sub
The problem is that the subforms don't appear to unload when changing
to another tab. For example, when I first open the main form and do
nothing except run a report - the report runs fine. When I click on
all of the tabs and then run a report - the report craps out. When I
first click on a tab there's a slight delay before its subform opens.
When I click away from it and then back to it then there's no delay in
the subform loading. This coupled with the fact that the report craps
out is telling me that the subforms aren't unloading entirely.
How can I get the subforms to unload? Or is this not the problem?
Thanks for your help!