Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab Control Events Not Firing 1

Status
Not open for further replies.

grgimpy

Programmer
Nov 1, 2006
124
US
I have a form with a Tab Control with multiple pages. On each page is a different form. The main form takes time to load and uses many resources b/c of the number of forms opened. When the form opens on the first page, I want all the SourceObject properties of each form on the other pages to be set to nothing. This part I can do easily.

Now the part I don't get: When the user clicks on a tab for another page, I want the form on that page to load. I have tried using the On Change event in the Tab Control and was able to accomplish this, but not for each individual tab. I only want forms to load on pages when they are clicked on by the user. I also tried using the On Click events in each individual tab, they do not fire for some reason.

Basically, I only want forms to load when the user wants to looks at them to save time in loading the main form and use less resources.

Thanks for any help and suggestions.
 
In the Change event procedure of the TabControl use its Value to get the Page index and thus know which tab was clicked.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PH,

I actually just found this out on MS support web site. I don't know if I would have thought of this anytime soon.
Thanks for the quick response.

Here's a code example from MS in case anyone is interested:

Code:
Private Sub TabCtl0_Change()
   Select Case Me!TabCtl0.Value ' Returns Page Index.
      Case 0  ' Page Index for Page 1.
         MsgBox "You have selected Company Info"
      Case 1  ' Page Index for Page 2.
          MsgBox "You have selected Personal Info"
   End Select
End Sub
 
grgimpy . . .

Be aware . . . your form takes a long time to load because [blue]each subform has a recordsource[/blue]. You need to [blue]default the recordsources to nothing (empty/blank)[/blue] then update them per tab page selected! . . .

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top