Set Subform at runtime?

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Using Access 2002 is it possible to change a forms subform at runtime so
that if a checkbox 1 on the main form is ticked Subform A is used, however
if checkbox 2 is ticked, Subform B is used.


TIA

Tom
 
A form does not really "have a subform". A form has one or more subform
/controls/, each of which has a form in it.

Say that a main form frmMain, has a subform /control/ ctlSub, and you
want to change the form in that subform control, to frmNew:

me![ctlSub].sourceobject = "frmNew"

You might also need to reset the linkmasterfields and/or
linkchildfields properties of ctlSub. Try it & see.
 
PS. So you would add an AfterUpdate event for the checkbox. That event
will fire whenever the user ticks or clears the box. Your code (in that
event) would just see what value the checkbox now had, then use the
statement that I gave you, to load the desired form into the subform
control.
 

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

Back
Top