artemi said:
I tried this code. It doesn't return any sort of error, but it also doesn't
result in any changes.
did I do something wrong?
Private Sub TabControl_Change()
Select Case Me.TabControl
Case 3 ' no. of subform page
Select Case Me.Type
Case "Query Only"
Me.Criteria_Subform.SourceObject = 3 'choice of form on drop down
list (I also tried it with the name of the form, i.e. "Query Only Subform"
Case "Import"
Me.Criteria_Subform.SourceObject = 1
Case "Mapping"
Me.Criteria_Subform.SourceObject = 2
End Select
End Select
End Sub
The Case statements need the tab page number of the page
with the subforms. You said that is only one page with a
subform, so there should only be one Case statement (unless
you are doing other things on other pages).
The SourceObject property must be set to the name of the
form object that you want the subform control to display.
Your explanation of how/which form is specified (in a combo
box??) is too vague for me to be specific, but at this point
I'm guessing it would be something along these lines:
Private Sub TabControl_Change()
Select Case Me.TabControl
Case 3 ' no. of subform page
Select Case Me.Type
Case "Query Only"
Me.Criteria_Subform.SourceObject = "Query Only
Subform"
Case "Import"
Me.Criteria_Subform.SourceObject = "import form"
Case "Mapping"
Me.Criteria_Subform.SourceObject = "map form"
Case Else
MsgBox Me.Type & " is not in the Select Case list"
End Select
End Select
End Sub
You need to verify that 3 is the correct tab page number.
Also, make sure of the names of the forms being used as
subforms.
You said it "doesn't result in any changes", but even with
the wrong form names, it should have displayed something
different, probably a blank subform control.