Hello,
I am trying to format the report to print similar to a graybar report, but with the color changing only when a certain column's data changes. And to complicate things a bit, I have a subreport within the main report. So, the resulting report would look something like this:
33556622 subreportdata data from main report<grey>
subreportdata <grey>
subreportdata <grey>
3355825 subreportdata data from main report<white>
subreportdata <white>
subreportdata <white>
subreportdata <white>
etc...
I tried a procedure I found here, which changed every other line, and that worked fine when I put it within the subreport and the main report. However, my code is not doing a darn thing. I am wondering if there is a way to use the code I got from TT to do this.
Here is my code(this is abbreviated for space reasons, as there are a lot of field names)
And here is the code from TT:
Any thoughts are greatly appreciated!
Laurel
___________________________________________________________
With your thoughts you create the world--Shakyamuni Buddha
I am trying to format the report to print similar to a graybar report, but with the color changing only when a certain column's data changes. And to complicate things a bit, I have a subreport within the main report. So, the resulting report would look something like this:
33556622 subreportdata data from main report<grey>
subreportdata <grey>
subreportdata <grey>
3355825 subreportdata data from main report<white>
subreportdata <white>
subreportdata <white>
subreportdata <white>
etc...
I tried a procedure I found here, which changed every other line, and that worked fine when I put it within the subreport and the main report. However, my code is not doing a darn thing. I am wondering if there is a way to use the code I got from TT to do this.
Here is my code(this is abbreviated for space reasons, as there are a lot of field names)
Code:
Private m_intCounter As Integer
Private m_strPrevWPC As String
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo Err_Detail_Format
Const GREY As Long = 13553358
'Increment counter only if record is a different txtWP from the previous textWP.
If m_strPrevWPC <> txtWP Then m_intCounter = m_intCounter + 1
'Set greybar
'Greybar is Grey on even counts (counts based on change of WPC)
If m_intCounter Mod 2 = 0 Then
txtBlock.BackColor = GREY
txtZONE.BackColor = GREY
txtWP.BackColor = GREY
txtPLN_S.BackColor = GREY
txtPLN_C.BackColor = GREY
Else 'Odd counts are normal back color
txtBlock.BackColor = vbWhite
txtZONE.BackColor = vbWhite
txtWP.BackColor = vbWhite
txtPLN_S.BackColor = vbWhite
txtPLN_C.BackColor = vbWhite
PCT_C.BackColor = vbWhite
End If
m_strPrevWPC = txtWP
Err_Detail_Format:
If Err <> 0 Then MsgBox Err.Number & ": " & Err.Description
End Sub
And here is the code from TT:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'Michael Red. 2/13/2002. To 'Toggle the backolor, which
'Provides alternate line shading
Const XorToggle = 4144959
Me.Detail.BackColor = Me.Detail.BackColor Xor XorToggle
End Sub
Any thoughts are greatly appreciated!
Laurel
___________________________________________________________
With your thoughts you create the world--Shakyamuni Buddha