• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 41
  • Last Modified:

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!
0
alfamikefoxtrot
Asked:
alfamikefoxtrot
  • 2
  • 2
  • 2
  • +2
4 Solutions
 
PatHartmanCommented:
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"
                Else
                    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"
                Else
                    pgNum.Caption = "**124"
                End If
            Case "pgIBC125"
            
            Case "pgIBC126"
                If IsNull(Me.sfrmIBC126.Form!VER_NO) Then
                    pgNum.Caption = "  126"
                Else
                    pgNum.Caption = "**126"
                End If
                Call cboProviderType_AfterUpdate
            Case "pgIBC127"
                If IsNull(Me.sfrmIBC127.Form!VER_NO) Then
                    pgNum.Caption = "  127"
                Else
                    pgNum.Caption = "**127"
                End If
            Case "pgIBC128"
                If IsNull(Me.sfrmIBC128.Form!VER_NO) Then
                    pgNum.Caption = "  128Old"
                Else
                    pgNum.Caption = "**128"
                End If
           Case "pgIBC128New"
                pgNum.Caption = "  128New"
                If IsNull(Me.sfrmIBC128New.Form!sfrmIBC128A1.Form!VER_NO) Then
                Else
                    pgNum.Caption = "**128"
                End If
                If IsNull(Me.sfrmIBC128New.Form!sfrmIBC128A2.Form!VER_NO) Then
                Else
                    pgNum.Caption = "**128"
                End If
                If IsNull(Me.sfrmIBC128New.Form!sfrmIBC128C.Form!VER_NO) Then
                Else
                    pgNum.Caption = "**128"
                End If
                If IsNull(Me.sfrmIBC128New.Form!sfrmIBC128D.Form!VER_NO) Then
                Else
                    pgNum.Caption = "**128"
                End If
            Case "pgIBC131"
                If IsNull(Me.sfrmIBC131.Form!VER_NO) Then
                    pgNum.Caption = "  131"
                Else
                    pgNum.Caption = "**131"
                End If
            Case "pgIBC133"
                If IsNull(Me.sfrmIBC133.Form!VER_NO) Then
                    pgNum.Caption = "  133"
                Else
                    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_Proc:
    Exit Sub
Err_Proc:
    MsgBox Err.Number & "-" & Err.Description
    Resume Exit_Proc
End Sub

Open in new window

0
 
Dale FyeCommented:
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.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
You might look at this:

http://www.lebans.com/tabcolors.htm

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.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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

Jim.
1
 
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....!
3
 
alfamikefoxtrotAuthor Commented:
Thanks guys....!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now