Tab Control Back Color

  • Thread starter Thread starter Hammy
  • Start date Start date
H

Hammy

Guest
Hi all,

Using Access 2003, WinXP SP2.

I have a form with the standard light grey background. I insert a tab control, and the default back color is white. I set the BackStyle to Transparent, and it still displays as white.

Am I missing something here, I want the back color of the tab control to be the same as my form.

Now, what's really odd, is in this project it creates tab controls as white, but if I open an old project of mine, it creates tab controls with the same light grey back ground of the form.

Any help?
TIA
Hammy
 
I think the tab control inherits a 'Windows' object color and it can't be changed unless you change the 'Windows' property....
 
Yep, you nailed it...kinda.

Access 2003 apparently has a default "Use windows color scheme" for objects. Need to disable it in TOOLS>OPTIONS>FORMS/REPORTS

I must say, I find it somewhat bewildering that they don't have a backcolor property for the tab control :confused:

Hammy
 
Yep, you nailed it...kinda.

Access 2003 apparently has a default "Use windows color scheme" for objects. Need to disable it in TOOLS>OPTIONS>FORMS/REPORTS

Hammy


But this is only a local setting isn't it?
I mean if I want to use that DB to another PC I should disable the option you mention to that PC too.
 
I think I'll go with the tab strip instead of the tab control since I found that the tab strip does have a color property.
Do you know of any drawback that could prevent one to use tab strip instead of the default tab control?

And another thing I'd like to ask. The tab control has this irritating feature to remain in front of all objects even thoug you force it to back.
Is there any indirect way to send it behind an object e.g a rectangle? This would solve all the above problems.
 
Last edited:
I think I'll go with the tab strip instead of the tab control since I found that the tab strip does have a color property.
Do you know of any drawback that could prevent one to use tab strip instead of the default tab control?
The drawback is that a user might experience a MISSING reference issue due to the tab strip being an ActiveX control and those are prone to potential problems on other users' machines.
And another thing I'd like to ask. The tab control has this irritating feature to remain in front of all objects even thoug you force it to back.
Is there any indirect way to send it behind an object e.g a rectangle? This would solve all the above problems.
That is what it is designed for, to mask items so it stays on top of everything. You can put something on the tab control that shows on every page, but you can't "mask" it. To do so, you would have to hide it.
 
Easy way to change your TabControl color

I've spent the last couple of days working on this problem. It's been nagging me for ages, but I finally spent the time to resolve it.

The sample code at http://www.mvct.com/AccessCodeSamples.asp contains detailed instructions but essentially you create a rectangle behind the Tab Control, set the TabControl's BackStyle property to Transparent and voila a nice repeatable way to change the color of a tab. There are several gotchas, and my sample code also contains a prebuilt ActiveX DLL which does all the work for you - you simply manually add the rectangle at design time (it doesn't need to match the size of the tab control, and the tab control can be resize without need to resize the rectangle since the rectangle will automatically resize itself at runtime.

Let me know how it works out!
 
Here's another test run of the same technique. This is not the best, because it uses no tab controls whatsoever, just subforms and labels, one on top of the other, on top of the other, on top of the other, etc...

This would get a bit confusing I would think... :p
 
Last edited:
Hi all,

Using Access 2003, WinXP SP2.

I have a form with the standard light grey background. I insert a tab control, and the default back color is white. I set the BackStyle to Transparent, and it still displays as white.

Hi all. New guy here. I keep hearing mention of this BackStyle property but I am unable to find it anywhere. I've tried the tab control property menu but no luck.

Also, why is it that, when using a tab control, you can't copy or drag controls from another section in the form without that control being duplicated on all of the other pages of the tab control.

Thank you.
 
Last edited:
The sample code at http://www.mvct.com/AccessCodeSamples.asp contains detailed instructions but essentially you create a rectangle behind the Tab Control, set the TabControl's BackStyle property to Transparent and voila a nice repeatable way to change the color of a tab. There are several gotchas...

And one of the "gotchas" the author listed is that it's not supported in v2003, which the OP is using! What version(s) did you test in?
 
Here's a quick little tutorial I give people on the use of Tabbed Pages. It addresses some of the questions/points brought up here:

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.

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.

Hope this helps some.

Linq
 
Here's a quick little tutorial I give people on the use of Tabbed Pages. It addresses some of the questions/points brought up here:

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.

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.

Hope this helps some.

Linq

It helps more than some. You gave me a better explanation than even the Microsot online resources and this Access 2003 For Dummies book I've been grueling through.

Thanks.
 
Tabbed Pages are very handy, after you get used to using them. As you'll find out, they're much easier to use when you know going in that you're going to need them, rather than adding them later as an after thought and having to move controls around.

Good luck with your project!

Linq
 
Tabbed Pages are very handy, after you get used to using them. As you'll find out, they're much easier to use when you know going in that you're going to need them, rather than adding them later as an after thought and having to move controls around.

Good luck with your project!

Linq

My 2 cents:

The tab control is a savior when it comes to having a lot of fields in a single record that you need to display. They can even be used to group or categorize controls into a logical manner. On the reverse side it's easy to get out of control with a tab control and try to put too much data out there and try to make a single form a one size fits all form. For example, if you put sub forms on numerous tabs you do so at a potential performance hit. Even though you cannot see the sub form and its data the sub form is still accessing it and putting locks on it, etc. If you're saying 'it'd be nice to have it' verses 'it's required that we have it', think twice - :)
 
If you're saying 'it'd be nice to have it' verses 'it's required that we have it', think twice - :)

Excellent advice, not only vis a vis tabbed controls, but in reference to form design in general! It never ceases to amaze me at the number of people who spend hours and hours and hours trying to turn a database application into a video arcade, and then flaming about how "stupid" Microsoft is not to make it easy to have dancing chickens and singing bears on their database screen! :D

Linq
 
For example, if you put sub forms on numerous tabs you do so at a potential performance hit. Even though you cannot see the sub form and its data the sub form is still accessing it and putting locks on it, etc.

A good point and, for example, I do put many subforms on a tab control, but to control this behavior I remove the recordsource from the subform and assign it to each one via code when the tab is accessed. That way the main form loads fast and the other subforms load when they are needed and not before. If they never get to any of them, they never load. It works well that way.
 
As I heard Mary Chipman say when accessing data tables: Get in, do what you need to do and get out
 
as a newbie, i find it a nuisance that you can only put related fields in tabbed forms, or that there's no obvious way that i can find to make an urelated tab window of some sort.

For example, i'm working on an encyclopedia node to a database for a massage business. to create this encylopaedia, i had to create a form to act as a 'switch' of sorts with command buttons and create each section of the encyclopaedia in spearate forms INSTEAD of being able to put all the encycleopaedia in one tabbed form (the forms are actually very little, and only have things like "definition of terms" and lists of muscles showing their function etc...).

so, instead of being able to tab thru the encyclopaedia to access whatever the user wants, they have to close and open each section individually (because the sections are not directly related). this also makes the encyc sections a little messy b/c it's hard making them look the same when i have to create each one individually rather than in tabs.

*sigh* i understand why access does this, but it also frustrates me that i can't have the encyclopaedia in an all-in-one area. would it really be so hard for the microsoft access developers to incorporate such a feature?? (or am i whining about this ignorantly while there lies within the guts of access a perfectly usable system for what i want?)

as an analogy: it's like having each volume of a 23 volume paper copy encyclopaedia in a different room of a library, rather than all on one bookshelf.
 
Tabs can be used with unrelated data, but you have to use subforms, because a form can only have a single recordset at a time. However, it is best to not use the same recordsource as another form when they are all together on a single form.
 

Users who are viewing this thread

Back
Top Bottom