swithching subforms

SunWuKung

Registered User.
Local time
Today, 10:09
Joined
Jun 21, 2001
Messages
172
I have an unbound subform on a form.
On the main form I have an option button and I would need to change which subform to display as the option button changes. (no, I can't just modify the recordsource of the subform because the layout needs to change slightly as well)

Could somebody show me what is the code to change between subforms?

Many thanks.
SWK
 
This is possible, but there is no code to 'change' between forms that I know of. So you'll have to close and open forms each time the command button is clicked. I think you should better have the two forms opened (eventually superposed) and make them visible/invisible using the command button (closing, opening forms is a much slower a memory-intensive operation).
 
Last edited:
Thanks Alexandre,

In the meantime I found the following solution with SourceObject: Me.Content_ChooseFrom.SourceObject = "Content_ChooseIntQ"

but you are probably right and I will experiment with Visible.

Thanks again.
SWK
 
In this scenario changing the sourceobject is your best move. I have written one application where my whole interface is done through subforms. I have twenty+ subforms swapping out with each other, simply by changing the SourceObject.
 
SWK-

Doulostheou's suggestions are absolutely on-mark! For the past 1-1/2 years, I've written all of my applications using a mainform, swapping in and out the necessary subforms. It's a bit of a foreign concept at first but, once you get used to it, you're forms will have a specific consistency and the users will love it.

Bob
 
Yes,
now that I know how to do it, it is nice and smooth. For the time being I decided to use the SourceObject way instead of switching visible on-off, I felt that it is easier to keep some order on my form and I the change is instant this way too.

Thanks guys for the help.

SWK
 

Users who are viewing this thread

Back
Top Bottom