Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Backcolor change in Detail Section on SubReport 1

Status
Not open for further replies.

101287

MIS
Apr 8, 2006
189
US
Does anyone can help me to have the instruction below to work? I have a subreport that I'm calling from a main report and would like to change the backcolor to vbYellow is the Me.Baselined is "y". I'm using Ms Office 2007 and
I try using Me.Report.Section(acDetai).backColor = vbYellow but it does not work if there are more than one detail line. I have the code below in the OnFormat_Detail Event.


If Me.Baselined = "Y" Then
'Reports!NeedDateScoreCard!NeedDateScoreCardDetail!!Detail.backColor = vbYellow
end if

Suggestions will be appreciated.

Luis
 
Is the baseline in the main report or the sub?
try
Code:
If Me.Baselined = "Y" Then
    me.Detail.backColor = vbYellow
else
    me.Detail.backColor = SomeOthercolor
end if
 
The baseline is in the subReport. Your suggestion does not work when there are more than one record in the subReport.

The last baseline record determine the color of the detail line. In other words, the code does not put backcolor to each independent line in the subReport. Hopefully, I explained correctly the problem. However, if there is only one record on the subReport it works correctly.

Any other suggestion please.

Luis
 
If Me.Baselined = "Y" Then
Me.Section("Detail").BackColor = vbYellow
Else
Me.Section("Detail").BackColor = SomeOthercolor
End If
 
pwise - Try your code and have the same problem that I mentioned previously. The problem is that the entire section of the subreport is color. Need to be able to color the detail for each line on the report. Any other thoughts ...please.

Luis
 
The code work for one single record. However, when there are more than one record on the record it does not work.
For example,

(1) Baseline Y
(2) Baseline Y
(3) Baseline N
OnFormat:
If Me.Baselined = "Y" Then
me.Detail.backColor = vbYellow
else
me.Detail.backColor = SomeOthercolor
end if

Results:
(1) SomeOtherColor
(2) SomeOtherColor
(3) SomeOtherColor

What it looks like is that the final execution of the If, override the Section backcolor.

Maybe there is not way to do what I was planning on doing. Thank you'll for guidance provided.

Luis
 
Are you viewing the Report Preview or some other view? Code doesn't run in all views.

I generally place one large text box behind the entire detail section and set its background based on Conditional Formatting. Make sure the backgrounds of all your other controls are transparent.

Duane
Hook'D on Access
MS Access MVP
 
I was viewing the report in Report view. However, I incorporated your suggestions regarding the text box behind the detail section and it works like a champ.

Thank you.

Luis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top