Alternating table background colors

N

Newton

I know how to alternate table row bgcolor by odd/even method but what I am
trying to acheive is alternate colors by the date value in the database so
that each row with the same date value has the same bgcolor. There maybe 3
red rows for 1st date, then 2 blue rows for 2nd date, then 6 red rows for
next date etc.
I have no idea where to start, any suggestions?
 
R

Roji. P. Thomas

Dim curdate
Dim prevdate
Dim bgcolor
If Not rs.eof
curdate = rs("datecolumn")
prevdate = curdate
while not rs.eof
curdate = rs("datecolumn")
If curdate <> prevdate Then
If bgcolor = "blue" Then
bgcolor = "red"
else
bgcolor = "blue"
end if
prevdate = curdate
End If

'Process record
Wend

Untested, Ofcourse ;)
 

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

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top