Display subforms according to conditions

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."
 
M

Marshall Barton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top