Tab Control behaviour (1 Viewer)

Carl_R

Registered User.
Local time
Today, 12:39
Joined
Aug 16, 2002
Messages
82
I have a form that is bound to a query. On the form, I have inserted a Tab control. When I place controls in one Tab, they seem to replicate across all other Tabs in my Tab Control.

I'm assuming this isn't by design else, what's the point in having Tabs.

Oh, there are no subforms placed in the Tabs.

Any ideas (I know I'm doing something wrong!)
 

missinglinq

AWF VIP
Local time
Today, 06:39
Joined
Jun 20, 2003
Messages
6,420
Here's a quick little tutorial I give people on the use of Tabbed Pages. It addresses some of the common problem experienced with them, including the problem you've encountered:

First thing to remember is that the Tabbed Pages are all part of a single form; think of it as a really long form turned on its side. Because it is all one form, all referencing to any control on it is done in the same manner as if they were all on one single screen. Create a form in Design View. Goto the toolbox and click on the Tabbed Control icon; it actually looks like several manila file folders. Place it on your form and adjust the size to your liking. If you need more than the two tabbed pages it initially gives you, click on the tabbed control to select it. Goto Insert and click on Tabbed Control Page and another tabbed page will be added. Do this as many times as necessary.

This is the really important part: when you go to add a control to a tabbed page, you must first click to select one of the pages, then add the control. Otherwise, the control will be added to the form itself, and will show thru on all tabbed pages!

Once you have the form's Control Source (your table or a query) set up, you simple add controls as you normally would, heeding the above paragraph.

Also important to understand! If you go to move a control from one part of your main form to a tabbed page, cannot drag and drop it! You must cut it, select the tabbed page, then paste it! And if the control has any code behind it, a GotFocus, OnClick, etc, after dropping it on the tabbed page, you'll have to "re-connect" it to its code. Select the control, goto Properties, click to the right of [Event Procedure] on whatever event to bring up the ellipsis (...) then click it to go to the code window. Exit the code editor and the control and its event code will be connected.[/font] One last thing. When trying to access the Properties of the Tabbed Control, such as the BackStyle, people complain that they can't find property. The problem is that they haven't selected the Tabbed Control, they've selected one of the pages of the Tabbed Control! The best way to be sure of selecting the Tabbed Control itself is to click to the right of the last tab. If you have 2 tabs, for instance, click in the blank area where Tab 3 would be, if you had a
Tab 3.
 

Carl_R

Registered User.
Local time
Today, 12:39
Joined
Aug 16, 2002
Messages
82
Gotcha! Very informative and has solved my issue. Certainly didn't know about the drag-drop v cut-paste. I thought I was going mad :)
 

Users who are viewing this thread

Top Bottom