Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2009
    Posts
    2

    Unhappy Change Row Background Color Programmatically

    I have a report and I want the backcolor to change based on the value in a field named color. Here is the code:

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Select Case Me.Color
    Case Purple
    Me.Detail.BackColor = RGB(204, 204, 255)
    Case "Green"


    Me.Detail.BackColor = RGB(204, 236, 255)
    Case Yellow
    Me.Detail.BackColor = RGB(255, 255, 204)
    Case Blue
    Me.Detail.BackColor = RGB(204, 236, 255)
    Case Orange
    Me.Detail.BackColor = RGB(255, 204, 153)
    Case Grey
    Me.Detail.BackColor = RGB(221, 221, 221)
    Case Else
    Me.Detail.BackColor = vbRed
    End Select
    End Sub

    This has no effect. However I was able to change the background color of a box set behind the other fields with this code. The problem was that it set all fields to the value from the last box.

    Any help is greatly appreciated

  2. #2
    sassy is offline Novice
    Windows 7 Access 2007
    Join Date
    Oct 2009
    Posts
    3

    Question

    i hv got the same issue here but ia still trying

  3. #3
    Join Date
    Oct 2009
    Posts
    2

    Cool Problem Solved

    I was able to get the problem solved. The code, for Access 2007 has to appear in the on Paint event, while it appeared in the on format event in previous versions. I hope this helps someone else and saves them hours of frustration! Happy coding!

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

Similar Threads

  1. Change font color in Query
    By Brian62 in forum Queries
    Replies: 2
    Last Post: 01-10-2013, 09:14 PM
  2. Color/font change in subform
    By AndyKim in forum Forms
    Replies: 9
    Last Post: 06-24-2009, 04:34 PM
  3. background color in a form
    By taggart in forum Forms
    Replies: 1
    Last Post: 05-07-2009, 10:37 AM
  4. change cell color
    By bishop743 in forum Programming
    Replies: 0
    Last Post: 02-01-2009, 11:00 AM
  5. Change the colour of a form background
    By r_e_v_a_n_s in forum Forms
    Replies: 0
    Last Post: 11-15-2005, 03:39 AM

Tags for this Thread

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