Forums
This topic is locked
Rotate row/column cell colors on results page
Posted 05 Oct 2001 23:35:46
1
has voted
05 Oct 2001 23:35:46 Jeff Hansen posted:
I wish to rotate the color of the cells with each new row... ie. blue,red,blue,red as the rows are added. This is of course for dynamic data comign from the db. Anyone know how to do this?Jeff
Replies
Replied 06 Oct 2001 15:04:53
06 Oct 2001 15:04:53 Owen Eastwick replied:
This block of code should give you the general idea:
<pre id=code><font face=courier size=2 id=code>
<% Counter = 1 %>
<% While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))%>
<%If Counter Mod 2 = 0 Then%>
<tr bgcolor="#C0C0C0" valign="top">
<td width="50"><font size="-2" face="Arial, Helvetica, sans-serif"><%=(Recordset1.Fields.Item("TextID".Value)%>
</font></td>
<td width="150"><font size="-2" face="Arial, Helvetica, sans-serif"><%=(Recordset1.Fields.Item("ItemTitle".Value)%>
</font></td>
<td width="500"><font size="-2" face="Arial, Helvetica, sans-serif"><%= Replace(Recordset1.Fields.Item("ItemText".Value,VbCrLf,"<br>"%>
</font></td>
</tr>
<% Else %>
<tr bgcolor="#E5E5E5" valign="top">
<td width="50"><font size="-2" face="Arial, Helvetica, sans-serif"><%=(Recordset1.Fields.Item("TextID".Value)%>
</font></td>
<td width="150"><font size="-2" face="Arial, Helvetica, sans-serif"><%=(Recordset1.Fields.Item("ItemTitle".Value)%>
</font></td>
<td width="500"><font size="-2" face="Arial, Helvetica, sans-serif"><%= Replace(Recordset1.Fields.Item("ItemText".Value,VbCrLf,"<br>"%>
</font></td>
</tr>
<% End If %>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Counter = Counter + 1
Wend
%>
</font id=code></pre id=code>
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Edited by - oeastwick on 10/07/2001 10:15:51
<pre id=code><font face=courier size=2 id=code>
<% Counter = 1 %>
<% While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))%>
<%If Counter Mod 2 = 0 Then%>
<tr bgcolor="#C0C0C0" valign="top">
<td width="50"><font size="-2" face="Arial, Helvetica, sans-serif"><%=(Recordset1.Fields.Item("TextID".Value)%>
</font></td>
<td width="150"><font size="-2" face="Arial, Helvetica, sans-serif"><%=(Recordset1.Fields.Item("ItemTitle".Value)%>
</font></td>
<td width="500"><font size="-2" face="Arial, Helvetica, sans-serif"><%= Replace(Recordset1.Fields.Item("ItemText".Value,VbCrLf,"<br>"%>
</font></td>
</tr>
<% Else %>
<tr bgcolor="#E5E5E5" valign="top">
<td width="50"><font size="-2" face="Arial, Helvetica, sans-serif"><%=(Recordset1.Fields.Item("TextID".Value)%>
</font></td>
<td width="150"><font size="-2" face="Arial, Helvetica, sans-serif"><%=(Recordset1.Fields.Item("ItemTitle".Value)%>
</font></td>
<td width="500"><font size="-2" face="Arial, Helvetica, sans-serif"><%= Replace(Recordset1.Fields.Item("ItemText".Value,VbCrLf,"<br>"%>
</font></td>
</tr>
<% End If %>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Counter = Counter + 1
Wend
%>
</font id=code></pre id=code>
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Edited by - oeastwick on 10/07/2001 10:15:51