Shading

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to shade specific lines in the detail.
For Example: A report with names and ages:

Name: Age:
Joe 21
Sally 45
Dan 42

I want to shade all the Sally's in the report.

I assume I need to write the SQL, but I cannot find anything in my books to
get me started..

Help
 
Not SQL. A few lines of VBA in the Format event of the report's Detail
section ...

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

'Replace TestText with the actual name of your field.
If Me.TestText = "Sally" Then
Me.Section("Detail").BackColor = 8421504
Else
Me.Section("Detail").BackColor = vbWhite
End If

End Sub

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
I need to shade specific lines in the detail.
For Example: A report with names and ages:

Name: Age:
Joe 21
Sally 45
Dan 42

I want to shade all the Sally's in the report.

I assume I need to write the SQL, but I cannot find anything in my books to
get me started..

Help

SQL?

Code the Report Detail Format event:

If Me![NameField] = "Sally" Then
Me.Section(0).BackColor = 12632256
Else
Me.Section(0).BackColor = vbWhite
End If

Make sure the BackStyle property of each control in the Detail Section
is set to Transparent.
Change the colors as needed.
 
Back
Top