Problem ending loop through recordsets

# Thread: Problem ending loop through recordsets

1. Sally Heatherington Guest

## Problem ending loop through recordsets

I have the following problem: <BR>I am trying to write 4 records for each &#060;TR&#062; in a table. I receive an "error &#039 80020009&#039Exception occurred." whenever the last row writes less than 4 records to the &#060;TR&#062;.<BR><BR>Q: How can I exit a loop when the recordset reaches EOF given the counter for i=0 To 3 does not end on 3?<BR><BR>DIM i<BR>i=0<BR>Do While Not RSpeople.EOF<BR> <BR> Response.Write ("&#060;TR&#062;")<BR>For i=0 to 3<BR> Response.Write ("&#060;TD ALIGN=CENTER&#062;&#060;FONT FACE=ARIAL SIZE=1 COLOR=#FFFFFF&#062;" & i )<BR> If Len (RSpeople("ImageName")) &#062; 2 Then <BR> Response.Write ("&#060;IMG SRC=""http://intranet/38th/" & DivisionName & "Web/Personnel/" & RSpeople("ImageName") & """ HEIGHT=90 WIDTH=75&#062;")<BR> Else<BR> Response.Write ("&#060;IMG SRC=""http://intranet/38th/" & DivisionName & "Web/Personnel/NoImage.gif"" HEIGHT=90 WIDTH=75&#062;")<BR> End If<BR> Response.Write("<BR>&#060;FONT FACE=ARIAL SIZE=2 COLOR=" & theTextColor & "&#062;" & RSpeople("LastName") & ",Â*" & RSpeople("FirstName") & "&#060;/TD&#062;")<BR> <BR> RSpeople.Movenext<BR>Next<BR> Response.Write ("&#060;TR&#062;")<BR>Loop<BR><BR>Thank you so much for any help!<BR><BR>

2. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## RE: Problem ending loop through recordsets

If i = 3 then<BR>exit do<BR>end if

3. Sally Heatherington Guest

## RE: Problem ending loop through recordsets

Ahhh, <BR>Exit Do ! I was having problems figuring out what the syntax is for exiting a loop.<BR>Thanks for making my day!<BR><BR>Sally

#### Posting Permissions

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