Color Coding a record in the detail section

C

ChuckW

Hi,

I have three types of records in the detail section of my record. One is
2007Actual, the second is 2008Atual and the third is 2008Budget. The other
fields are CustomerName, Jan, Feb, Mar etc. I want to color code all records
that have the Type field as 2008Budget. Is there a way to do this?

Thanks,
 
F

fredg

Hi,

I have three types of records in the detail section of my record. One is
2007Actual, the second is 2008Atual and the third is 2008Budget. The other
fields are CustomerName, Jan, Feb, Mar etc. I want to color code all records
that have the Type field as 2008Budget. Is there a way to do this?

Thanks,

Code the Detail Format event:
If Me![Type] = "2008Budget" then
Me.Section(0).BackColor = 12632256
Else
Me.Section(0).Backcolor = vbWhite
End If

For best appearance, make sure the BackStyle of each control is set to
Transparent.

NOTE :
Type is a reserved Access/VBA/Jet word and should not be used as a
field name. Change the field name [Type] to something else.

For additional reserved words, see the Microsoft KnowledgeBase article
for your version of Access:

109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'

For an even more complete list of reserved words, see:
http://www.allenbrowne.com/AppIssueBadWord.html
 
M

Marshall Barton

ChuckW said:
I have three types of records in the detail section of my record. One is
2007Actual, the second is 2008Atual and the third is 2008Budget. The other
fields are CustomerName, Jan, Feb, Mar etc. I want to color code all records
that have the Type field as 2008Budget. Is there a way to do this?


Not sure how you determine which record type each record
belongs to, but I will assume it's a field in the record
source.

You can set the section's BackColor by using a little code
in the detail section's Format event procedure:

If Me.typefield = "2008Atual" Then
Me.section(0).BackColor = vbYellow
Else
Me.section(0).BackColor = vbWhite
End If

You may also want to set all the label and text box
control's BackStyle to Transparent.
 

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