Link to home
Create AccountLog in
Avatar of BBlu
BBluFlag for United States of America

asked on

Color Alternate Rows with Different Colors SubForm

AccessYourBiz_Com so kindly helped me with a form/subform question I had (https://www.experts-exchange.com/questions/26651591/Form-and-Related-SubForm-Tutorial-part-I.html)

I'm trying to figure out how he got the alternate rows to be different colors.  I thought it was the "Alternate Back Color" in the Detail Properties, but that doesn't do anything. ChargeBacks-TEMP.accdb ChargeBacks-TEMP.accdb
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

In Access 2007 this is easy.

Click on the Detail bar in the form design view.

Right click and display the properties dialog, then click the Format tab.

Finally, set the Alternate Back Color to a color of your choice.
If you want to get a little more creative, and use three different colors then you can use the Detail sections Paint event, somethinge like:

Private Sub Detail_Paint()

    Static intDetail As Integer
   
    intDetail = intDetail + 1
    If intDetail = 3 Then intDetail = 0
   
    If intDetail = 0 Then
        Me.Detail.BackColor = RGB(255, 155, 255)
    ElseIf intDetail = 1 Then
        Me.Detail.BackColor = RGB(155, 255, 100)
    Else
        Me.Detail.BackColor = RGB(255, 255, 100)
    End If
   
End Sub
Avatar of BBlu

ASKER

I tried changing the color (on both the subform and main form) and nothing changes. User generated image User generated image
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of BBlu

ASKER

Got it!  Thanks, fyed.