Results 1 to 3 of 3
  1. #1
    SpdRacerX is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    40

    If/Else If help to Change BackColor


    So far I have figured out the following:

    Code:
    Private Sub High_Risk_Status_AfterUpdate()
    If Me.[High-Risk.Status] = "Active" Then
    Me.Section(acDetail).BackColor = 8421631 'Gray
    Me.Auto_Title0.BackColor = 8421631 'Gray
    Else
    Me.Section(acDetail).BackColor = 12632256 'Red
    Me.Auto_Title0.BackColor = 12632256 'Red
    End If
    End Sub
    
    Private Sub Form_Current()
    If Me.[High-Risk.Status] = "Active" Then
    Me.Section(acDetail).BackColor = 8421631 'Gray
    Me.Auto_Title0.BackColor = 8421631 'Gray
    ElseIf Me.[Behavorial] = -1 Then
    Me.Section(acDetail).BackColor = 8421631 'Gray
    Me.Auto_Title0.BackColor = 8421631 'Gray
    Else
    Me.Section(acDetail).BackColor = 12632256 'Red
    Me.Auto_Title0.BackColor = 12632256 'Red
    End If
    End Sub
    
    Private Sub Behavorial_AfterUpdate()
    If Me.[Behavorial] = -1 Then
    Me.Section(acDetail).BackColor = 8421631 'Gray
    Me.Auto_Title0.BackColor = 8421631 'Gray
    Else
    Me.Section(acDetail).BackColor = 12632256 'Red
    Me.Auto_Title0.BackColor = 12632256 'Red
    End If
    End Sub
    What I need is it to change the Back Color of the Title to Red if High-Risk = "Active", to Yellow if Behavorial = "Yes" and to leave it alone if none of the two criteria is met.

    I've tried some combinations but I just can't seem to get it. Right now the code turns it Red if either are met.

    Thank-you for any help.

  2. #2
    SpdRacerX is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    40
    Nevermind. I figured it out by making two different If Else statements rather than ElseIf.

  3. #3
    SpdRacerX is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    40
    Seems when I change the Behavorial to Yellow it doesn't work, it turns every record to Red. Am I missing something?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Flash Textbox Backcolor White and Red
    By Power in forum Programming
    Replies: 3
    Last Post: 10-13-2011, 03:53 PM
  2. simple backcolor code ?
    By markjkubicki in forum Forms
    Replies: 7
    Last Post: 09-16-2011, 12:25 PM
  3. On change
    By clarkej in forum Forms
    Replies: 3
    Last Post: 01-19-2011, 08:33 AM
  4. Replies: 1
    Last Post: 10-22-2009, 03:32 AM
  5. Replies: 0
    Last Post: 10-24-2008, 11:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums