Tab Colors in Access2000

B

Basil

I have looked at http://www.lebans.com/tabcolors.htm, however, I'm still not
able to get my tabs to change color. Can I accomplish this by setting
attributes in Properties for each tab (i.e. same width and height, and
different tag #s)? Or do I have to write VB code (which I don't have any
experience in)?
 
S

Stephen Lebans

Here is a previous post of mine on this subject:

' **********************************************
From: Stephen Lebans ([email protected])
Subject: Re: Background color on a "tab" form
View: Complete Thread (5 articles)
Original Format
Newsgroups: microsoft.public.access.formscoding
Date: 2002-01-30 16:26:05 PST



Open your form in Design view.

Select the TAB control itself...not one of the individual TAB pages. Enter a
value for the Tab Fixed Height and Width properties.

Now Select each of the individual TAB Pages in turn. Enter a color RGB value
in each Page's TAG property. If you are unfamiliar with RGB color codes
simply enter 255 for now.


You have to take the time to look at the code behind the sample Form. As you
can see from the code below you have to add code to the following
Sections/Events behind your Form/Tab control.


1) The Declarations section at the top of your Form
2) The Form Load and UnLoad events
3) The Tab control Change event.


The only things you have to change are the names of your Tab control and
the Rectangle control used to simulate a color for the Background of the
Tab control.
So in the sample, I named the TAB control "tabCtl" and the Rectangle
control "RecBG".
Just change these names to those of the controls you are using on your
Form.
Me.TabCtl
Me.RecBG


There's nothing else to tell you. If you are not comfortable implementing
this code solution then honestly you simply should not use it.


Good Luck.


' Here's the code behind the sample Form.


Option Compare Database
Option Explicit


' Var of type Tab class
Private TB As clsTabs


Private Sub Form_Load()
'DoCmd.MoveSize 0, 0, 6650, 4800


' Create an instance of our TabColors class
Set TB = New clsTabs


' You MUST set the TabControl prop
TB.TabControl = Me.TabCtl
' You MUST set the BackGround control
' used to display the current pages background color
TB.BGControl = Me.RecBG
' Parent Form
TB.TabForm = Me


' Set the desired Rotation amount
TB.RotateDegree = 90


' Create the Tabs
TB.MakeTabs


End Sub


Private Sub Form_Unload(Cancel As Integer)
Set TB = Nothing
End Sub


' **********************************************



--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
B

Basil via AccessMonster.com

Thanks. Now I am getting the following error when I try to view the form:
The expression On Load you entered as teh event property setting produced the
following error: User-defined type not defined. What do I need to define for
this? I've got to be close, because I keep looking at TabColorExample code
and my code and I don't see what else is different.

I tried to follow your instructions. I did the following: set TabControl
itself Fixed H/ W, set each page's tag property to a different color, and
included the code exactly like your sample. I then renamed my Tab control
and Rectangle control to match the code sample.
 
B

Basil via AccessMonster.com

Yes - I downloaded the db application TabColorExample. Should I be looking
at the Tabs form or the TabsMinimal form? I used the TabsMinimal code, but
it seems like I would also need the additional code at the bottom of the Tabs
form code to make it work - otherwise, I don't see where it steps through
each tab to know what to change the color to.

Also, how does the RecBG fit in? If it were providing a BG color, I would
think it would stretch over the area to be colored. Must not...

Do you have the class clsTabs from Stephen's sample?
Thanks. Now I am getting the following error when I try to view the form:
The expression On Load you entered as teh event property setting produced
[quoted text clipped - 98 lines]
 
D

Douglas J. Steele

You downloaded the example, but did you copy the class from the example into
your application?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Basil via AccessMonster.com said:
Yes - I downloaded the db application TabColorExample. Should I be
looking
at the Tabs form or the TabsMinimal form? I used the TabsMinimal code,
but
it seems like I would also need the additional code at the bottom of the
Tabs
form code to make it work - otherwise, I don't see where it steps through
each tab to know what to change the color to.

Also, how does the RecBG fit in? If it were providing a BG color, I would
think it would stretch over the area to be colored. Must not...

Do you have the class clsTabs from Stephen's sample?
Thanks. Now I am getting the following error when I try to view the
form:
The expression On Load you entered as teh event property setting
produced
[quoted text clipped - 98 lines]
any
experience in)?
 

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