display invisible sub?

M

Maarkr

I have a main form, with a subform that is only visible when the appropriate
cmdbtn is clicked, which loads the associated form. Works well:

Private Sub CommandCSC_Click()
Child45.SourceObject = "CSCfrm"
Child45.Visible = True
End Sub

One of these forms uses the web activeX control, loading a web page. This
works well, but it sometimes takes up to 15 seconds to load the web page. So
I decided to load that form up as not visible when the main form is started,
then make it visible when the associated cmdbtn is clicked, so it comes up
instantly.
Problem is, I can make the form visible, but I can't figure how to make it
visible inside the subform. It becomes visible and now has the focus instead
of the main form:

Private Sub CommandWX_Click()
If CurrentProject.AllForms("WXfrm").IsLoaded = True Then 'check to see
if it is loaded
Forms!WXfrm.Visible = True 'this loads it as the primary form
Child45.SourceObject = "WXfrm" 'I thought this may make the
form the subform but it doesn't
End If
Child45.Visible = True
End Sub

To recap... how to have the form become visible as the child45 source object.
 
J

Jeanette Cunningham

Hi Maarkr,
When a form loads, the subform loads before the main form loads.
I am not aware of any way to open a form by itself and then make it become a
subform inside the subform control of an already open form.
You could try this method:
If you make the subform control invisible, it can be loading the subform
invisibly.
To make both the subform control and the subform visible:
Me.Child45.Visible = true
Not sure that this will help with the speed of opening the main form.

Jeanette Cunningham
 
M

Maarkr

Well, you gave me an idea that I thought may work, but didn't. I tried using
a different sub control name for just that form, but no go. I'll just have
to think about it for awhile. Thanks
 
J

Jeanette Cunningham

I have found a sample database which hides or shows a subform on a form.
This may be helpful for you.
The sample is called 'ShowOrHideSubform'

From the website
www.databasedev.co.uk

It was there some months ago when I downloaded it - I am assuming the sample
is still there.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
M

Maarkr

that didn't solve what I wanted, but you gave me the idea to use more than
one subform...thanks
 

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