Display a different subform based on combo box selection

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

On the form "IssuesForm", I want to select a value from a combo box "cboIssueType", hit a button "btnDisplayIssueSubform", and then have a subform appear depending on what value I selected on my combobox.

I want the subform "RM" to appear if I select "RM" from my combo box, cboIssueType.
I want the subform "NonRM" to appear if I select "NonRM" from my cboIssueType.

My aim here is to avoid having multiple windows open. Thanks.
 
Karnegie23 said:
On the form "IssuesForm", I want to select a value from a combo box
"cboIssueType", hit a button "btnDisplayIssueSubform", and then have a
subform appear depending on what value I selected on my combobox.
I want the subform "RM" to appear if I select "RM" from my combo box, cboIssueType.
I want the subform "NonRM" to appear if I select "NonRM" from my cboIssueType.

My aim here is to avoid having multiple windows open. Thanks.

Assuming both of the subforms are linked in some way to the current record
of
the parent form just set the visible property of the subforms.
 
I'm sorry, I a newbie, can I ask you to elaborate on that response a bit? What should I set visibility to?
 
Karnegie23 said:
I'm sorry, I a newbie, can I ask you to elaborate on that response a bit?
What should I set visibility to?
"rkc" wrote:

Place both your subforms on the parent form as you would if each
were the only subform that was being used. Using send to
back/bring to front from the Format menu will help while doing
this. In the OnClick Event of btnDisplayIssueSubform add code
to set the visible property of the appropriate subform.

The long, easily understood version of code to do that would look like:

Select Case cboIssueType.Value
Case "RM"
Me.RM.Visible = True
Me.NonRM.Visible = False
Case "NonRM"
Me.RM.Visible = False
Me.NonRM.Visible = True
End Select

 
Back
Top