every other record when looping?

# Thread: every other record when looping?

1. Junior Member
Join Date
Dec 1969
Posts
12

## every other record when looping?

when looping through a recordset, how can I make every other row a certain color based upon the sort order that I set in the SQL statement. (i.e. in a roster of players, how can I make every other row a differnt color)<BR><BR>Thanks

2. Senior Member
Join Date
Dec 1969
Posts
2,958

## simple

In the head put<BR><BR>&#060;%<BR>colors = Array("#ffffff","#F8F4F8") <BR>count = 0<BR>%&#062;<BR><BR>replace the colors with those of your own choosing. You canb have as many as you&#039;d like but 2 or 3 is better on the eyes.<BR><BR>Then for each row<BR><BR>&#060;td width="whatever" bgColor="&#060;%=colors(count)%&#062;"&#062;<BR><B R>Then in the loop<BR><BR>RS.MoveNext<BR> count = count + 1 <BR> If count &#062; UBound(colors) Then count = 0 <BR> Loop<BR><BR>I think this is in the FAQ&#039;s above.

3. Senior Member
Join Date
Dec 1969
Posts
2,437

## even numbers

may be odd<BR><BR>rowNumber = 0<BR>while not recordset.eof<BR>if rowNumber mod 2 = 0 then<BR>&#039;this color<BR>else<BR>&#039;that color<BR>end if<BR>recordset.movenext<BR>wend<BR>

4. Junior Member
Join Date
Dec 1969
Posts
12

## Thanks...

thanks guys...

5. Senior Member
Join Date
Dec 1969
Posts
353

## yet another way

Assuming your loop increment variable is i, in the loop:<BR><BR> If i/2 = i2 Then<BR> Set color = "#00FF00"<BR> Else<BR> Set color = "#0000FF"<BR> End If

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•