By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,762 Members | 1,845 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,762 IT Pros & Developers. It's quick & easy.

Tab Control Color

100+
P: 675
MSAccess says there is no way to have a Tab Control with a color. Is this true?
Dec 28 '07 #1
Share this Question
Share on Google+
15 Replies


jaxjagfan
Expert 100+
P: 254
MSAccess says there is no way to have a Tab Control with a color. Is this true?
I dont know about 2007 but previous versions of access do not allow you to set tab colors.
Dec 28 '07 #2

100+
P: 675
Thank you.

OldBirdman
Dec 28 '07 #3

missinglinq
Expert 2.5K+
P: 3,532
You can change the back color of tabbed pages to that of the underlying Detail Section by setting the tab control's Back Style property to Transparent. If using ACC2003 and this doesn't work, goto Properties - Forms/Reports and make sure that Use Window Themed Controls is unchecked.

If you want a color other than the underlying color, even different colors for different pages, try Stephen Lebans Tab Colors Hack.

Linq ;0)>
Dec 29 '07 #4

100+
P: 675
I tried "Stephen Lebans Tab Colors Hack." and don't see how to set tab color from this site.

If I am missing something, please tell me what?

OldBirdman
Jan 10 '08 #5

mshmyob
Expert 100+
P: 903
You cannot change the color of the tab only the color of the tab page. Not even in 2007.
Jan 11 '08 #6

missinglinq
Expert 2.5K+
P: 3,532
Actually you can, as you'll see if you download Leban's Tab Sample Database. You'll find that Stephen never promises something unless he can deliver!

Birdman, what have you tried so far? I haven't really worked with Leban's code, just downloaded it and saw what it could do. His posted code usually deals with complicated issues and as such, are not simple! You do have to follow his instructions.

Linq ;0)>
Jan 11 '08 #7

mshmyob
Expert 100+
P: 903
I did try that download about 6 months ago and I couldn't get it to work also. But probably because I didn't fully understand it.

You would think that MS would have a property for this since people have been trying to do it for years.
Jan 11 '08 #8

100+
P: 675
What a response to a question that I thought would require a one-word answer.

First, I guess the question was ambiguous, if not to me, then to many of you. I wanted the control to be of a different color, and was not necessarily needing the individual tabs to be colored. After all, my command buttons are all gray, so why not the tabs?

If I can change the color of the tab control, it is to make the BackStyle transparent. This will apply to all the pages of the TabControl. Individual TabPages are not independent.

My solution is to place a rectangle on the form, the same size and position as the TabControl. Then with the TabControl BackStyle = Transparent, the color of the rectangle comes through. I can even have each page a different color, by setting the rectangle color in the tab's OnChange Event.

I have been referred to Lebans before, and have downloaded & unzipped the sample programs. I have read the instructions on his website.

Lebans' programs always work as advertised. However, I do not have the knowledge to understand how/why they work, and cannot incorporate them into my programs. In this case, I don't think it actually works at all. I think that it apparently works, using movable pictures (Bitmaps). Maybe I'm mistaken here.

There is a second ambiguity in my initial question. Having Access do something, and having a program that apparently does something. My initial question looks like I was asking the later, but I was asking if Access can do it, not whether I make it look like it is being done.

OldBirdman
Jan 12 '08 #9

missinglinq
Expert 2.5K+
P: 3,532
As I said, Leban's hacks ususally involve complicated issues, and as such the solutions aren't simple! As to Access directly addressing it, you have to realize that while this issue comes up occasionally, issues like mouse wheels scrolling thru records and the hiliting of alternating lines in a datasheet/continuous form come up daily in Access forums, and yet they've just got around to solving this with ACC2007!

This is a good workaround, OldBirdman! I'll copy it to my reference folder and use it in the future, giving credit to you, of course, and citing TheScripts!

BTW, I understand your comment about Access doing something as opposed to a workaround being available. If you want to make this distinction in the future, ask something like "is there a native Access process to do yada yada yada?" or "is there an Access built in way to do yada yada yada."

Linq ;0)>
Jan 12 '08 #10

100+
P: 675
I shall remember that "Native Access" is different than an Access work-a-round. That should avoid some ambiguity.

Lebans' solutions are quite interesting. I do get lost in them, as I apparently use such a limited subset of Access that I don't understand most of what he is presenting.

OldBirdman
Jan 18 '08 #11

missinglinq
Expert 2.5K+
P: 3,532
Most people looking for a solution don't really care if it's an Access built-in solution or a custom solution, but if you do it's good to note it in your thread.

And I agree, Lebans' solutions are frequently complicated, because, as I said, they usually deal with complicated problems! I've used them, but it always takes me quite a while to completely understand them, which for me is a must!

Linq ;0)>
Jan 18 '08 #12

P: 12
I have spent the last several days on this issue, and have come up with a relatively easy and simple to implement methodology for changing the color of a TabControl in Access 2003. I'm sure this probably works equally well in Access 2007 although I have not personally tested it. Granted, this solution is not a "native" Access solution, but instead makes use of the Rectangle control (as detailed in posts above) to trick the user into believing the TabControl has the desired color. For more info and to download the code please visit ** Removed link to external code **

The link above has a much better description of the process and includes a very short, simple, code sample. Feel free to use it unrestricted.

This solution requires you to simply add a rectangle control (the size and position does not matter - although you would want to make sure it is "behind" the tab control in the Z-order. You then make a simple one-line call and the Tab changes color... It makes for a nice elegant solution.
Feb 21 '08 #13

100+
P: 675
I appreciate your several days, as I have also spent many days on an issue that I can find no reason Microsoft cannot support.

First, I found that my Rectangle solution will overwrite some controls, such as labels. So I wish to retract the previously submitted solutions.

Now, I read "The best way to use this is to create an ActiveX DLL project using VB5 or VB6. Using Visual Studio .Net to accomplish this will only cause you more headaches since .Net does not easily accommodate being called from a COM compliant (unmanaged) application." I do not deny that this is perfectly valid, but I don't know what an "ActiveX DLL" is, nor do I know what VB5 or VB6 is. I don't know what Visual Studio.Net is either, which is why I look for Native Access Solutions, even very creative ones.

So we want simple, or at least I do. Here is the simplist I could devise.
1)Create a (sub)Form, and assign a background color.
2)Create a Tab Control on this form.
3)On the main form, use the form created above as a subform.
4)Size everything so a)Tab Control is exact size of its form; b) SubForm control is exact size of the form used.
5)Tabs will still be grey, but body of Tab Control will be colored. If this is acceptable, and after all, command buttons are all grey, then this is the simplist solution I can come up with. Note: it is "Native Access".

OldBirdman
Feb 24 '08 #14

Expert 100+
P: 446
Hi

I was interested in fooling around with this. I have taken the code from MaxVernon's DLL and put into into an Access module to make it more 'Native'. This means that you do not have to register the dll 'AccessTC' or have a reference to it, which can be a bonus to some.

I have had to comment out code to make it run in Access 2002; apologies Max.

I've added a case statement to give control of the colours. They are hideous but it is a demo. Interestingly, controls do not show through from beneath.

Now I have seen this I want the Tabs coloured too!
S7
Attached Files
File Type: zip AccessTCSample.zip (16.0 KB, 787 views)
Feb 24 '08 #15

100+
P: 675
When I started this thread, I really only wanted to have a little contrast between the TabControl and the background color of the form. Not have each tab a different color. I mean, I just don't like monochrome forms. Unless my form is gray, the buttons contrast. I even change the form color if the form is "Filtered", so I don't panic if I can't find a record I know is there.

I have spent the entire morning trying to figure out why the CommandButton and Label show in the demo program. Mine do not. It humbles me to not be able to find the difference, and so solve my problem. The demo program works, mine does not. Reviewing this entire thread, the answer is probably in the "Z order", and whether the rectangle is actually "behind" the tab control. Don't understand that, sorry maxvernon.

I'm running the demo program on my machine, so that eliminates the operating system, the version of Access, and the hardware. I have compared properties line by line, and I can't find any significant differences. Sure, I don't have all that fancy code to dynamically size and position the Rectangle, but that shouldn't affect anything.

I deleted my Rectangle and TabControl on my form, and did a Copy/Paste of both from the demo. Now the command button shows through the rectangle, but the label does not. Labels attached to controls show, including labels on options, checkboxes, and option groups. If the rectangle is larger than the tab control, I hides almost all controls on the form under the rectangle. The exception is a SubForm.

If I create a subform containing a tabcontrol, and both are the same size, the subform shows through everthing (always on top). I can control the color with Me.Form.Detail.BackColor = 14868389 (Bluish). This does work, so I have colored individual tabs with similar logic to the demo program.

I got an added benefit with this. I can have a tab control on a tab control. I pasted my subform onto several tab pages in the demo. Works very nicely. Several of the tabs have the subform, which is only a tab control. Both levels are IN COLOR!! Not the little tabs at the top, they are still gray, but the body of the tab control is in color. Now I put the color in the Tag property as an 8 digit number (so if I later need the Tag for another purpose also, Mid(ctl.tag,9) will work always because 252 (red) is entered as 00000252, etc. so color is always Left(ctl.tag,8).

Now I need to get proficient with referencing subforms from the main form, other subforms, etc. I have tried to change the subform's backcolor from the main form, but can't get the section recognized, but this is another thread.

Again, I want to thank all of you for a great deal of time involved in this issue. I'm not sure that all this effort was just for my benefit, seems like some got hooked on the problem. Again, thanks.

OldBirdman
Feb 25 '08 #16

Post your reply

Sign in to post your reply or Sign up for a free account.