Prev: Needing help automatically generating info from a table to a form
Next: Option buttons for subform viewing
From: EBaker on 21 Dec 2009 17:58 Need some guidence on figuring this out PLEASE! subforms and forms related by "mainIDPK" . The following code is in the subforms 'Forms!Form1.mainIDPK' to link the child fields Form1 Option group named "actionpanel" The following options available: Action Panel label Name Numerical value MMRB OptMMRB (1) FFD OptFFD (7) MEB OptMEB (3) PDES OptPDES (5) PEB OptPEB (4) Closed OptClosed (6) Subforms: frmBlank frmMMRB frmFFD frmMEB frmPDES frmPEB frmClosed Common fields between Form1 and the subforms is "mainIDPK" The subforms are set to visible No in the subform properties I have them 'stacked' on Form1. What I want to do is this: If form1 opens and "MMRB" is already selected, it makes "frmMMRB" visible. (If there is a '0' in the actIDFK field, "frmBlank' covers al lthe other subforms) If I select "FFD" in the actionpanel, I want "frmFFD" to become visible (and frmMMRB become 'invisible'-but since the forms are stacked, the frmMMRB would be hidden anyway) I have been looking at these forums for almost a month trying to get some clue as to how this could work, bu have been unsuccessful. ANY help regarding properties, syntax, or how I can make this work is appreciated in advance!
From: Jeanette Cunningham on 22 Dec 2009 03:00
One convenient way to manage multiple subforms is to have only one subform control. When you want a particular subform, you tell the subform to load it. This saves having stacked subform around. Here is sample code--> Select case me.OptMMRB Case 1 Me.[NameOfSubformControl].SourceObject = "frmMMRB" Case 2 Me.[NameOfSubformControl].SourceObject = "frmFFD" Case 2 Me.[NameOfSubformControl].SourceObject = "frmMEB" Case 2 Me.[NameOfSubformControl].SourceObject = "frmPDES" End Select If you need to use different Link Master Fields and Link Child Fields for some fields, use code like this--> Me.[NameOfSubformControl].LinkMasterFields = "MainIDPK" Me.[NameOfSubformControl].LinkChildFields = "MainIDPK" Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia "EBaker" <u56990(a)uwe> wrote in message news:a0f0b557972e4(a)uwe... > Need some guidence on figuring this out PLEASE! > subforms and forms related by "mainIDPK" . > The following code is in the subforms 'Forms!Form1.mainIDPK' to link the > child fields > Form1 Option group named "actionpanel" > The following options available: > > Action Panel label Name Numerical value > MMRB OptMMRB (1) > FFD OptFFD (7) > MEB OptMEB (3) > PDES OptPDES (5) > PEB OptPEB (4) > Closed OptClosed (6) > > Subforms: > > frmBlank > frmMMRB > frmFFD > frmMEB > frmPDES > frmPEB > frmClosed > > Common fields between Form1 and the subforms is "mainIDPK" > > The subforms are set to visible No in the subform properties I have them > 'stacked' on Form1. > > What I want to do is this: > If form1 opens and "MMRB" is already selected, it makes "frmMMRB" visible. > (If there is a '0' in the actIDFK field, "frmBlank' covers al lthe other > subforms) > If I select "FFD" in the actionpanel, I want "frmFFD" to become visible > (and > frmMMRB become 'invisible'-but since the forms are stacked, the frmMMRB > would > be hidden anyway) > > I have been looking at these forums for almost a month trying to get some > clue as to how this could work, bu have been unsuccessful. ANY help > regarding properties, syntax, or how I can make this work is appreciated > in > advance! > |