Insert a Subform at Runtime

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to insert a subform into a form at runtime? I've figured out
how to create a new subform and build it from scratch, but I'd prefer just to
insert an already created subform.

Thanks for any help you can provide.
 
dchman said:
Is it possible to insert a subform into a form at runtime? I've
figured out how to create a new subform and build it from scratch,
but I'd prefer just to insert an already created subform.

Thanks for any help you can provide.

Why on earth would you need to do that?

What you can easily do is have a subform that is hidden by default and then
make it visible. You can also assign different forms as the SourceObject to
a subform control on the fly.
 
thanks for the quick response. Why I want to do this is a long story -
suffice it to say that it seems to be the best way to do what the client
wants. Your suggestion to use the SourceObject is something I had overlooked
and works fine (Access is not my usual development environment). Thanks again
 
I found that creating subforms with modules at run time is useful because I
can create the forms on the fly at run time and attach as subform, this saves
alot of development and maintenance effort as I would have had to create
dozens of forms, and modify every time a field name changed or is added or
deleted from the associated table. It gets used once at runtime and then is
distroyed.
 
Also, this makes it possible for the end user to add or remove controls from
the form/sub forms, with modules, on their own, at run time, without knowing
any thing about the IDE or writing source code.
 

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