MS Access -- ability to change backcolor in subset of page-tabs in a single tab-control object

Hi all -- looking for a way to change the background color of a subset of page-tabs appearing in a tab-control object within MS Access. Specifically -- let's say I have an object containing ten pages -- I'd like the clickable tabs of five of them to have a background of yellow or blue) to distinguish them from the others. I'd like to avoid coloring the entire page blue, just the tab itself, but that isn't absolutely critical.

I've surveyed the literature (including what's here on EE) and am concluding that it's likely more trouble than it's worth, but I thought I'd put the question out there to ask the MVPs if you know of a function or procedure that I'm overlooking. This isn't a showstopper for me but it would be nice to be able to do so I can distinguish some elements from others.

Thanks in advance!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The simplest solution is probably to create a solid box and place it on the tabs that you want to have a different background color. Make the backStyle Solid and set the BacK Color to whatever you want.  Make sure the box is behind all the other controls on the tab.

If what you are talking about is the tab itself, there is only a single property and that applies to all tabs so you cannot change its color.  You can add pictures in addition to text and you can add a small colored square which might work to highlight the text.

In one of my apps that uses a complicated tab control, When the form opens the app analyzes all the tabs and determines which have data.  It  then changes the name on the tab to add "**" as a prefix.  this is a visual indication that a tab has data.  The code runs in the main form's Load event.  Notice that the tab control (TabCtlTransactions) and the individual tabs (pgIBC122, pgIBC123, etc) all are named.  This means your code won't have to change if you decide to shuffle the tab page sequence.
Public Sub SetTabs()

    Dim pgNum As Object
    On Error GoTo Err_Proc
    For Each pgNum In Me.TabCtlTransactions.Pages
        Select Case pgNum.Name
            Case "pgIBC121"
                'don't forget to set txtPPTS_ID here and remove from 123 when this tab becomes the first tab
            Case "pgIBC122"
                'don't forget to set txtPPTS_ID here and remove from 123 when this tab becomes the first tab
            Case "pgIBC123"
                If IsNull(Me.sfrmIBC123.Form!VER_NO) Then
                    pgNum.Caption = "  123"
                    pgNum.Caption = "**123"
                    'this statement is here because the change event doesn't fire for the first tab and so the PPTS_ID doesn't get set
                    Me.txtPPTS_ID = DLookup("PPS_PPTS_STS_NO", "PCR_PCR_PPTS_STS", "PPCR_PRV_CHG_RQT_NO = " & Me.PPCR_PRV_CHG_RQT_NO & " And VER_NO = " & Me.sfrmIBC123.Form!VER_NO & " AND PCR_CORP_FORM_CD_NO = " & IBC123)
                End If
            Case "pgIBC124"
                If IsNull(Me.sfrmIBC124.Form!VER_NO) Then
                    pgNum.Caption = "  124"
                    pgNum.Caption = "**124"
                End If
            Case "pgIBC125"
            Case "pgIBC126"
                If IsNull(Me.sfrmIBC126.Form!VER_NO) Then
                    pgNum.Caption = "  126"
                    pgNum.Caption = "**126"
                End If
                Call cboProviderType_AfterUpdate
            Case "pgIBC127"
                If IsNull(Me.sfrmIBC127.Form!VER_NO) Then
                    pgNum.Caption = "  127"
                    pgNum.Caption = "**127"
                End If
            Case "pgIBC128"
                If IsNull(Me.sfrmIBC128.Form!VER_NO) Then
                    pgNum.Caption = "  128Old"
                    pgNum.Caption = "**128"
                End If
           Case "pgIBC128New"
                pgNum.Caption = "  128New"
                If IsNull(Me.sfrmIBC128New.Form!sfrmIBC128A1.Form!VER_NO) Then
                    pgNum.Caption = "**128"
                End If
                If IsNull(Me.sfrmIBC128New.Form!sfrmIBC128A2.Form!VER_NO) Then
                    pgNum.Caption = "**128"
                End If
                If IsNull(Me.sfrmIBC128New.Form!sfrmIBC128C.Form!VER_NO) Then
                    pgNum.Caption = "**128"
                End If
                If IsNull(Me.sfrmIBC128New.Form!sfrmIBC128D.Form!VER_NO) Then
                    pgNum.Caption = "**128"
                End If
            Case "pgIBC131"
                If IsNull(Me.sfrmIBC131.Form!VER_NO) Then
                    pgNum.Caption = "  131"
                    pgNum.Caption = "**131"
                End If
            Case "pgIBC133"
                If IsNull(Me.sfrmIBC133.Form!VER_NO) Then
                    pgNum.Caption = "  133"
                    pgNum.Caption = "**133"
                End If
            Case "pgIBC134"
            Case "pgIBC138"
'''                If IsNull(Me.sfrmIBC138.Form!VER_NO) Then
'''                    pgNum.Caption = "  138"
'''                Else
'''                    pgNum.Caption = "**138"
'''                End If
            Case Else
        End Select
    Next pgNum
    Exit Sub
    MsgBox Err.Number & "-" & Err.Description
    Resume Exit_Proc
End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dale FyeOwner, Developing Solutions LLCCommented:
Another way to accomplish this would be to emulate a tab control with command buttons and a subform control.  You can make the background of command buttons transparent and put a colored box behind each button.  Then, on the click event of the button, you would simply change the SourceObject of the subform.

Of course, this would not work if the data on more than one of the "tabs" is associated with a single record in a single table.  But if each of the tabs is for displaying data from different subforms or recordsets, then this technique might work for you.
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
You might look at this:

I've messed with it in the distant past.
If there are API calls (can't remember), you might have to tweak them a bit.
Good luck.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Too bad Access will no longer open A97 databases.
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
OP doesn't state version
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
I can convert it if need be.

alfamikefoxtrotAuthor Commented:
Hi guys -- sincerest apologies for not getting back on this in a timely manner - unexpected personal issue involving 1) older son and 2) court, hopefully resolved now. I actually tried a converted Lebans option and it didn't pan out, at least to the extent that it wouldn't take a fair amount of messing with to get to an endpoint. Both Pat and Dale have given me some good options to chew on. Working through code today, will let you know how it goes and then figure out solutions and points.

BTW -- I'd just like to pass a big THANKS to all four of you (Pat, Dale, Joe, and Jim)  -- beyond just this single question, each of you have helped me considerably with many questions I've had along the way and your input and knowledge have been essential. I don't think you guys get thanked enough but I wanted to take a minute to do just that. Your input and willingness to help are truly appreciated....!
alfamikefoxtrotAuthor Commented:
Thanks guys....!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.