Rexolio
Technical User
- Aug 29, 2001
- 230
I have posted some code that I am using below. I have a table with 3 columns that pulls info from my database. I want each column to be a different color. The code I've pasted below works. The problem is I have to tell each column "If i = 1 OR i = 4 OR ...." This could be a REALLY LONG string, especially considering that there could be as many as 50,000 records!!! I'm looking for an easier way to do it:
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<%
i = 1
do until rsResults.eof
cellString1 = "<td width='33%' valign='top' bgcolor='#FFFF00'><font size='2' face='Arial'>" & rsResults("strName"
& "<br>" & rsResults("strAddress"
& "<br>" & rsResults("strCity"
& ", " & rsResults("strState"
& " " & rsResults("strZip"
& "</font></td>"
cellString2 = "<td width='33%' valign='top' bgcolor='#00FF00'><font size='2' face='Arial'>" & rsResults("strName"
& "<br>" & rsResults("strAddress"
& "<br>" & rsResults("strCity"
& ", " & rsResults("strState"
& " " & rsResults("strZip"
& "</font></td>"
cellString3 = "<td width='34%' valign='top' bgcolor='#00FFFF'><font size='2' face='Arial'>" & rsResults("strName"
& "<br>" & rsResults("strAddress"
& "<br>" & rsResults("strCity"
& ", " & rsResults("strState"
& " " & rsResults("strZip"
& "</font></td>"
if i = 1 OR i = 4 OR i = 7 OR i = 10 OR i = 13 OR i = 16 OR i = 19 OR i = 22 OR i = 25 OR i = 28 OR i = 31 OR i = 34 OR i = 37 OR i = 40 OR i = 43 OR i = 46 OR i = 49 OR i = 52 OR i = 55 OR i = 58 OR i = 61 OR i = 64 OR i = 67 OR i = 70 OR i = 73 OR i = 76 OR i = 79 OR i = 82 OR i = 85 OR i = 88 OR i = 91 OR i = 94 OR i = 97 then
response.write(cellString1)
else
if i = 2 OR i = 5 OR i = 8 OR i = 11 OR i = 14 OR i = 17 OR i = 20 OR i = 23 OR i = 26 OR i = 29 OR i = 32 OR i = 35 OR i = 38 OR i = 41 OR i = 44 OR i = 47 OR i = 50 OR i = 53 OR i = 56 OR i = 59 OR i = 62 OR i = 65 OR i = 68 OR i = 71 OR i = 74 OR i = 77 OR i = 80 OR i = 83 OR i = 86 OR i = 89 OR i = 92 OR i = 95 OR i = 98 then
response.write(cellString2)
else
if i mod 3 = 0 then
response.write(cellString3)
%>
</tr>
<tr>
<%
end if
end if
end if
i = i + 1
rsResults.movenext
loop
%>
</table>
Thanks in advance for any assistance!!!
Rexolio
rexolio@bellsouth.net
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<%
i = 1
do until rsResults.eof
cellString1 = "<td width='33%' valign='top' bgcolor='#FFFF00'><font size='2' face='Arial'>" & rsResults("strName"
cellString2 = "<td width='33%' valign='top' bgcolor='#00FF00'><font size='2' face='Arial'>" & rsResults("strName"
cellString3 = "<td width='34%' valign='top' bgcolor='#00FFFF'><font size='2' face='Arial'>" & rsResults("strName"
if i = 1 OR i = 4 OR i = 7 OR i = 10 OR i = 13 OR i = 16 OR i = 19 OR i = 22 OR i = 25 OR i = 28 OR i = 31 OR i = 34 OR i = 37 OR i = 40 OR i = 43 OR i = 46 OR i = 49 OR i = 52 OR i = 55 OR i = 58 OR i = 61 OR i = 64 OR i = 67 OR i = 70 OR i = 73 OR i = 76 OR i = 79 OR i = 82 OR i = 85 OR i = 88 OR i = 91 OR i = 94 OR i = 97 then
response.write(cellString1)
else
if i = 2 OR i = 5 OR i = 8 OR i = 11 OR i = 14 OR i = 17 OR i = 20 OR i = 23 OR i = 26 OR i = 29 OR i = 32 OR i = 35 OR i = 38 OR i = 41 OR i = 44 OR i = 47 OR i = 50 OR i = 53 OR i = 56 OR i = 59 OR i = 62 OR i = 65 OR i = 68 OR i = 71 OR i = 74 OR i = 77 OR i = 80 OR i = 83 OR i = 86 OR i = 89 OR i = 92 OR i = 95 OR i = 98 then
response.write(cellString2)
else
if i mod 3 = 0 then
response.write(cellString3)
%>
</tr>
<tr>
<%
end if
end if
end if
i = i + 1
rsResults.movenext
loop
%>
</table>
Thanks in advance for any assistance!!!
Rexolio
rexolio@bellsouth.net