manipulating multiple subforms

303factory

Registered User.
Local time
Today, 03:11
Joined
Oct 10, 2008
Messages
136
Hi all

My applications main screen has about 15 subforms layered ontop of each other (all identical size) Depending on which dataset the user is looking at only one will be visible.

This has worked fine for many years but its a real pain to do any design changes, if I want to widen the forms or change their position slightly i have to carefully move each subform and layer them perfectly ontop of each other so there is no bits sticking out etc

Any way I can combine these so there is only one thing to resize/move?

Regards

303
 
Take a look of how I do it:

On your main form you add one subform and give it a name, say DisplayPanel
Then when you click on a menu option or a command button code the following

Forms("FrmMain")("DisplayPanel").SourceObject = "SubFormName"

This will refresh the subform source so there is no need to have muliple subforms on one main form.


I have attached a sample mdb to show what I mean.
David
 

Attachments

Last edited:
what DCrake suggested will also make your application thiner as only one subform will be loaded at a time (I guess now you hide/unhide them).
but it might take a bit longer to change the subforms, but unless they are very very heavy it shouldn't be noticeable at all.
 
wow thats so much faster and more efficient.. thanks guys :D
 
um how do I reference controls on the subform now?

'Me.subfrmname.button' is no longer working as the subform is no longer a subsection of the parent form. Also
Me.displayPanel.button wont work and Me.displayPanel.subfrmName isnt working either..
 
I intially had this problem and this is what I did to resolve it

Forms!FrmMain.Form!DisplayPanel.Form!SubFormControlName = "Whatever you want it to be"


David
 
awesome.. that did the trick nice one.

where would i be without this forum..
 
here's a slightly trickier one

I used to switch between datasheet and form view with the following code

DoCmd.RunCommand acCmdSubformDatasheetView
DoCmd.RunCommand acCmdSubformFormView

However 'the command or action 'SubformDatasheetView' is not available now.. I must confess I dont really understand the DoCmd function very well so have no idea what's changed to not allow this to wok
 
Is it the subform that you are toggling?

David
 

Users who are viewing this thread

Back
Top Bottom