adding and removing subforms from subform controls

P

Paul

I have a main form with a tab control, and I would like to write some VBA
code that would do two things:

1. check to see if a subform control has a subform assigned to it, and if
not,
2. add a subform to that subform control.

I know how to use a Select Case statement to capture the page the user
clicked in the tab control. What I would like to do is load that page's
subform when the user selects that page if it has not yet been assigned.
I've tried different assignment statements of the form

Forms!frmActivity!ctl_Contacts.Form = Forms!frm_contacts_sub and
Forms!frmActivity!ctl_Contacts.Form = "frm_contacts_sub"

but neither of those statements work.

In doing this, I'm following up on a suggestion made by one of the MVPs a
few months ago. I thought I saved that message, but I can't find it
anywhere. In that conversation, we were discussing ways to improve the
loading time of a form with multible subforms in a tab control. That was
where he suggested the technique of only loading the subform when the user
clicks on the tab page. I'd like to try it out, but I need to find out how
to assign a subform to a subform control.

Thanks in advance,

Paul
 

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