Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop "Blank Record Set"

Status
Not open for further replies.

JrClown

Technical User
Oct 18, 2000
393
US
I have a form with 5 input fields. On submit, I'm displaying the data just submitted below the form.
Here's my problem. I don't know how to make the loop NOT crash when there's no data yet.

field1: <%=RS(&quot;field1:&quot;)%><br>
field2: <%=RS(&quot;field2:&quot;)%><br>
field3: <%=RS(&quot;field3:&quot;)%><br>
field4: <%=RS(&quot;field4:&quot;)%><br>
field5: <%=RS(&quot;field5:&quot;)%><br>
QUOTE OF THE DAY
&quot;The most important ingredient in the formula of success is knowing how to get along with people&quot;
<%
Jr Clown
%>
 
I don't see the loop in your example but you have to check the eof

<%if not rs.eof then%>
field1: <%=RS(&quot;field1:&quot;)%><br>
field2: <%=RS(&quot;field2:&quot;)%><br>
field3: <%=RS(&quot;field3:&quot;)%><br>
field4: <%=RS(&quot;field4:&quot;)%><br>
field5: <%=RS(&quot;field5:&quot;)%><br>
<%end if%>

or

field1: <%=iif(not rs.eof,RS(&quot;field1:&quot;),&quot;&quot;)%><br>
field2: <%=iif(not rs.eof,RS(&quot;field1:&quot;),&quot;&quot;)%><br>

or some other like that. It depends on your needs
Stevie B. Gibson
 
Thanks
I actually found an example on my book and modified it.
Here it is
<%
Do While Not RS.EOF
%>
<tr>
<td width=&quot;20%&quot;><font size=&quot;1&quot;><%=RS(&quot;field1&quot;)%> </font></td>
<td width=&quot;20%&quot;><%=RS(&quot;field2&quot;)%></td>
<td width=&quot;20%&quot;><%=RS(&quot;field3&quot;)%></td>
<td width=&quot;20%&quot;><%=RS(&quot;field4&quot;)%></td>
<td width=&quot;20%&quot;><%=RS(&quot;field5&quot;)%></td>
<td></td>
</tr>
<%
RS.MoveNext
LOOP
%>
QUOTE OF THE DAY
&quot;The most important ingredient in the formula of success is knowing how to get along with people&quot;
<%
Jr Clown
%>
 
OK, it is the solution I was trying to explain :p Stevie B. Gibson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top