Appling conditional formatting to a tab control based on its own value? (1 Viewer)

C.F.

Registered User.
Local time
Today, 14:52
Joined
Jan 7, 2009
Messages
17
I am a every 6-8 month Access novice. I have a database that I share with a handful of others that I'd like to be more "user freindly".

There is a tab control that has four tabs. When a user moves to a different record, I'd like for the tabs to show the Check Box picture with the tab name when there is content in the tab; if no content, just the tab name.

I figure this would involve appling conditional formatting to a tab control based on its own value. Any suggestions?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 19:52
Joined
Jul 9, 2003
Messages
16,349
I don’t believe it’s possible to apply any sort of conditional formatting in the manner you describe.

What is displayed on each tab at present?

How would you identify that a particular tab was not displaying any information?

For example if a particular tab was displaying unpaid invoices then an SQL statement could be written that would return the number of invoice rows, if this number was zero you would know that the tab was empty this would allow you to display or not display a checked box.
 

C.F.

Registered User.
Local time
Today, 14:52
Joined
Jan 7, 2009
Messages
17
The tabs' labels just have the name of each tab. I know I can manually add a picture of a check box to a tab label. I was just trying to have the check box added if there was info in the tab's text box; otherwise, the tab label would just show the name of the tab.
 

John Big Booty

AWF VIP
Local time
Tomorrow, 04:52
Joined
Aug 29, 2005
Messages
8,262
You can change the caption on the Tab by using;
Code:
Me.PageName.Caption = "Insert Your text or code here"
Your could certainly make that conditional on what was or wasn't checked.
 

C.F.

Registered User.
Local time
Today, 14:52
Joined
Jan 7, 2009
Messages
17
John - Thanks for the feedback!

As you can see in the attached pdf, I can add a picture "check box" to the tab "EA Notes" by going to design view, clicking on the tab title, going to its properties, selecting picture and then selecting check box. I can do this.

What I need help on is how to do this for the "Synopsis" tab when there is an entry in the synopsis field. I want a check box to appear with the "Synopsis" title whenever there is an entry in the synopsis field, and only "Synopsis" in the title when there is no entry in its field.

Does this rambling make any sense?
 

Attachments

  • v3 Sample Tab Control with check boxes.jpg
    v3 Sample Tab Control with check boxes.jpg
    99.7 KB · Views: 162

John Big Booty

AWF VIP
Local time
Tomorrow, 04:52
Joined
Aug 29, 2005
Messages
8,262
You should be able to use a logical test on your check box to determine what is shown on the tabs, it would look something like;
Code:
Dim Location As String
Dim Location2 As String
Location = "C:\Location\Graphic1.BMP"
Location2 = "C:\Location\Graphic2.BMP"
    
    If Me.CheckName = -1 Then
        Me.PageNumber.Caption = "Text Caption1"
        Me.PageNumber.Picture = Location
    Else
        Me.PageNumber.Caption = "Text Caption2"
        Me.PageNumber.Picture = Location2
        
    End If

This code will need to go in the Form's On Current event as well as the Check Box's On Click event
 

C.F.

Registered User.
Local time
Today, 14:52
Joined
Jan 7, 2009
Messages
17
Re: Applying conditional formatting to a tab control based on its own value?

I mirrored your information and tried this....

Code:
'On current event of main form[COLOR=black][/COLOR]
‘Check if Text66 is empty is True
‘Then nothing
‘Otherwise add the picture to Page62
[COLOR=black] [/COLOR]
[COLOR=black]Dim Location As String[/COLOR]
[COLOR=black]Location = “K:\Access Database\ABlueSm.BMP”[/COLOR]
[COLOR=black] [/COLOR]
[COLOR=black]If IsEmpty (Me.Text66) = True Then ME.Page62.Caption = “Nothing Here”[/COLOR]
[COLOR=black]Else[/COLOR]
                        Me.Page62.Picture = Location
            [COLOR=black]ME.Page62.Caption = “We’re Here”[/COLOR]
 
            End If

I get the blue box (ABlueSm.BMP) on Page 62 of every record, no matter what is in Text66! The Page 62 caption or name remains "Page62" on every page.

I'm baffled.
 

John Big Booty

AWF VIP
Local time
Tomorrow, 04:52
Joined
Aug 29, 2005
Messages
8,262
Have a look at the attached sample. Check the On Current Event of the Form, and the On Click event of the Check Box.

Be sure to copy the two images to the same location that you copy the DB.
 

Attachments

  • DB Tab Image.ZIP
    16.9 KB · Views: 146

Users who are viewing this thread

Top Bottom