Display subforms according to conditions

  • Thread starter Thread starter Jonathan Blitz
  • Start date Start date
J

Jonathan Blitz

I have a form.

What I need to do is display one of two subforms within that form depending
on certain parameters.

How do I make the subform dynamic?
I want the forms to appear in the same place.

I tried setting the Visible attribute but it doesn't seem to work.

Any ideas?

--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
 
Jonathan said:
I have a form.

What I need to do is display one of two subforms within that form depending
on certain parameters.

How do I make the subform dynamic?
I want the forms to appear in the same place.

I tried setting the Visible attribute but it doesn't seem to work.


Having two subform controls, one on top of the other and
setting them visible and invisible is one way to to this.

If certainparameters Then
Me.subformcontrol1.Visible = False
Me.subformcontrol2.Visible = True
Else
Me.subformcontrol1.Visible = True
Me.subformcontrol2.Visible = False
End If

If the two subforms are the same size, another way is to
have a single subform control and set its SourceObject
property to the name of the form you want it to display:

If certainparameters Then
Me.subformcontrol.SourceObject = "form1"
Else
Me.subformcontrol.SourceObject = "form2"
End If
 
Back
Top