How can I change the background color on Access 2003 reports?

G

Guest

My employee report is one employee w/info per page. How can I get the whole
page to be yellow if, let's say, the guy works for Billing Department. So
when I put his employee number in and it brings his record up it will be
yellow because he is in Billing. Can I make it so each department has a
different color? I can experiment but don't know where to go to begin. Thanks!
 
D

Duane Hookom

You can write code in the On Format event of a report section to set the
backcolor:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Select Case Me.txtDeptID
Case 1
Me.Detail.BackColor = vbYellow
Case 4
Me.Detail.BackColor = 12632256 'gray
Case Else
Me.Detail.BackColor = vbWhite
End Select
End Sub

Ideally, you would store the color number in a table of your departments.
That way you could change the colors without touching your code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top