Report Background colour

  • Thread starter Thread starter Bryan
  • Start date Start date
B

Bryan

Hi, Does anyone know how to change a line of code Someone
gave me. I have a code which I need to change the
background colour to, instead of alternating each line, I
need to alternate by 2 text feilds. The ones I wanted to
change by colour are when a different Drawing No and/or
Sht No comes up.I,m just new at access and dont know how
to write code. Her is the code I have.
Option Compare Database

Private m_RowCount As Long

Private Sub Detail_Format(Cancel As Integer, FormatCount
As Integer)
m_RowCount = m_RowCount + 1
If m_RowCount / 2 = CLng(m_RowCount / 2) Then
Me.Detail.BackColor = 15263976
Else
Me.Detail.BackColor = 14811135
End If
End Sub
Thanks Bryan
 
This would be much more than a single line of code, Bryan.
If you're going to program, you'll need to learn to break your ideas down
into rather small pieces.
Putting them into code from there can become almost trivial.

Look at what this code is doing:
it keeps a count of how many rows have been processed.
If that count is even, it assigns one backcolor, otherwise, it uses
another.

Now what you'll need to do is keep track of the *previous* DrawingNo and
ShtNo.
(This means you'll populate these variables - I'd use two - at the end
of the routine, instead of the beginning.)
When you write your comparison, you'll be comparing your current values to
the stored ones.

You haven't been very specific as to just what color changes you want to see
with which value changes, but I'm sure you can work that logic out yourself.

HTH
- Turtle
 
Back
Top