p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

access thread: open a form as subform, using a variable to select the subform.


Message #1 by "Tom Milbourne" <tom@b...> on Mon, 17 Jun 2002 23:15:08
Using Access 2000 does anyone know of a way to load a form as a subform, 
using a variable to choose the subform from the existing form set?
Stuck or What! Tom
Message #2 by "Gregory Serrano" <SerranoG@m...> on Tue, 18 Jun 2002 12:56:36
Tom,

<< Using Access 2000 does anyone know of a way to load a form as a 
subform, using a variable to choose the subform from the existing form set?
Stuck or What! >>

I can tell you how to do this in Access XP.  See if it works for Access 
2000.  The syntax can't be that different... I hope.

             Main Form:  frmParent
    Subforms to choose:  sfrFirst, sfrSecond, sfrThird, etc.
Subform object in main:  sfrChild
      Combobox on main:  cboChooseForm

Assuming that the value list in the combobox is the actual list of subform 
names, put this on the cboChooseForm's "After Update" event:

   Me.sfrChild.SourceObject = cboChooseFrom

Greg

Message #3 by "tom" <tom@b...> on Tue, 18 Jun 2002 21:40:53 -0400
I will try as you suggested and let you know the result, it does not quite
fit the scenario I am using
but if it works, I may be able to use the code you suggest.

What I have now is a Parent form with six unlinked subforms,
five of these ars constant the last form would be chosen using a seperate
Menu selection form.
It would be on the selection form that I would need to set the system
variable and then
utilise that variable on the parent, to load the appropriate SubForm!


Regards
Tom Milbourne
I.T. Manager
The Bernmar Group of Companies
Phone 1-246-419-8368
Visit us at http://www.barbadostraveller.com for a full list of our
services.


-----Original Message-----
From: Gregory Serrano [mailto:SerranoG@m...]
Sent: Tuesday, June 18, 2002 12:57 PM
To: Access
Subject: [access] Re: open a form as subform, using a variable to select
the subform.


Tom,

<< Using Access 2000 does anyone know of a way to load a form as a
subform, using a variable to choose the subform from the existing form set?
Stuck or What! >>

I can tell you how to do this in Access XP.  See if it works for Access
2000.  The syntax can't be that different... I hope.

             Main Form:  frmParent
    Subforms to choose:  sfrFirst, sfrSecond, sfrThird, etc.
Subform object in main:  sfrChild
      Combobox on main:  cboChooseForm

Assuming that the value list in the combobox is the actual list of subform
names, put this on the cboChooseForm's "After Update" event:

   Me.sfrChild.SourceObject = cboChooseFrom

Greg



  Return to Index