OPen form, but do not open subforms

S

Stephen

I have a forms with a number of subforms. Each subform is a child to a main
"clientid" in the main form. When I open the main form, it is blank until
the user selects which client to show the profile (i.e. populate the
subforms).

The problem I have is that when the main form is initially opened, it takes
a long time because it first opens the subforms. I am aware (and I believe
correct, but please help me if I am wrong) that when Access opens a form, it
actually tries to open the subforms first, and then opens the main form with
the populated "open" subforms.

I want the system to act accordingly:

When the main form is opened (e.g. from a control button on a separate
form), I want the program to bypass opening the subforms and all of the code
associated with them and to just open the main form. This will be VERY
fast. When the user selects the clientID on the main form, it will then
requery and refresh the subforms.

Is there a simple VB code that when run, will open a form, but not open the
subforms associated with it?

-Stephen
 
M

MacDermott

"Simple" is in the eye of the beholder, but here's one thing you could try:

with your main form in Design View, highlight each subform control and in
its SourceObject property remove the name of the form to be displayed.
Then in the code you run when you select a client, do the following for each
subform control:
Check whether the SourceObject is a blank string; if so:
set the SourceObject property to the name of the form to be
displayed.
reset its LinkMasterFields and LinkChildFields properties.
You may also need to refresh the subform control.

HTH
- Turtle
 

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

Top