Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2012
    Posts
    28

    Exclamation Unanswered: Conditional Formatting within Tab Control

    Hi,

    I'm struggling to figure this one out.
    I have an access 2010 form that has a tab control (3 of them)

    I have created a text field named "TabCheck" that is placed outside the tab control.

    I'm trying to create an expression or vba code to have that cell say "Check Other tabs" and possibly highlight it in yellow if "DateCreated" field from the other tabs are not null

    The problem I run into is that when I do Me.fieldname, it only lets me pick fields from that same tab not fields on different tabs.

    Thanks in advance

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    So specify the tabcontrol and page id. Check the on line help for the details of what properties of the tab control are exopsed.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Dec 2012
    Posts
    28
    Already tried doing that but no luck.
    I didn't save the code line. Let me try to recreate it and post it.
    Thanks

  4. #4
    Join Date
    Dec 2012
    Posts
    28
    Here's what I got. I think I got the naming method correct now but nothing actually happens when I give it a try.

    PHP Code:
    Private Sub TabCheck_BeforeUpdate(Cancel As Integer)
    If 
    Me.Ctl2DateCreated 1990 Then Me.TabCheck "Check Other tabs"
    End Sub 
    Last edited by AccessN00b; 08-26-13 at 09:20.

  5. #5
    Join Date
    Dec 2012
    Posts
    28
    Date section doesn't need quotes, does it?

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    date 'section' does need delimiters, which means using #
    and you are better off using iso format for the date, it avoids probelsm with internationalising code
    Code:
    If Me.Ctl2DateCreated > "#1990/1/1#".......
    I'd rather be riding on the Tiger 800 or the Norton

  7. #7
    Join Date
    Dec 2012
    Posts
    28
    Quote Originally Posted by healdem View Post
    date 'section' does need delimiters, which means using #
    and you are better off using iso format for the date, it avoids probelsm with internationalising code
    Code:
    If Me.Ctl2DateCreated > "#1990/1/1#".......
    Thank you. I'm very close.
    I can't get the backcolor to work. It gives me black or some reason. Tried all sort of colors and they all highlight the field black.
    Text and font are working great.

    Also, if I get the color to work, is there a command to remove the color if the cell is empty?
    I put clear down there just till I figure it out.

    Thanks again
    Code:
    Private Sub Ctl2DateCreated _BeforeUpdate(Cancel As Integer)
    If Me.Ctl2DateCreated >= "#1990/1/1#" Then
    Me.TabCheck= "Check Other Tabs"
    Me.TabCheck.BackColor = yellow
    Me.TabCheck.FontSize = 20
     
    ElseIf IsNull(Me.Ctl2DateCreated ) Then
    Me.SuppAlert = " "
    'Me.TabCheck.ForeColor = Clear
    End If
    End Sub

  8. #8
    Join Date
    Dec 2012
    Posts
    28
    I've played around with the field colors in the properties (solid and transparent) and still can't get it work.
    I know I've done it in the past before and it worked but it won't work in this database for some reason.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •