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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't find what I have wrong in this code

Status
Not open for further replies.

MONFU

Programmer
Oct 27, 2001
35
MT
Dear All,
I am retreiving some data from an Access database. My code is retreiving all the fields I want, however, instead of 5 dates, it is only retreiving 3 dates, so I guess I have something wrong with my loop. Hereunder I am attaching the piece of code that is giving me trouble. I appreciate a lot all the help you can give me. Thanks

<%
Case 2
titlerep = &quot;Milestones Summary&quot;
%>

<table width=&quot;78%&quot; height=&quot;77&quot; border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<%
rs.MoveFirst
' while not rs.EOF
do
curDate = rs(&quot;project_date&quot;)
%>
<tr bgcolor=&quot;#CCCCFF&quot;>
<td height=&quot;23&quot; nowrap colspan=&quot;8&quot;> <font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><b>Date</b>
<%
Response.Write( rs.Fields(&quot;project_date&quot;) )
%> </font> </td>
</tr>
<%
do
curArea = rs(&quot;company_area_id&quot;)
%>
<tr bgcolor=&quot;#CCFFCC&quot;>
<td height=&quot;20&quot; nowrap colspan=&quot;8&quot;><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><b>Company
Area Name</b> <%
Response.Write( rs.Fields(&quot;company_area_name&quot;) )
%> </font></td>
</tr>
<tr bordercolor=&quot;#999999&quot;>
<td height=&quot;17&quot; nowrap width=&quot;33%&quot; bgcolor=&quot;#CCCCCC&quot;> <font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><b>Client
Name</b> </font> </td>
<td height=&quot;17&quot; nowrap width=&quot;33%&quot; bgcolor=&quot;#CCCCCC&quot;> <font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><b>Project
Name</b> </font> </td>
<td height=&quot;17&quot; nowrap width=&quot;33%&quot; bgcolor=&quot;#CCCCCC&quot;> <font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><b>Milestone</b>
</font> </td>
</tr>
<%
do
%>
<tr>
<td height=&quot;14&quot; nowrap width=&quot;33%&quot; bgcolor=&quot;#FFE8E8&quot;><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><%
Response.Write( rs.Fields(&quot;client_name&quot;) )
%></font></td>
<td height=&quot;14&quot; nowrap width=&quot;33%&quot; bgcolor=&quot;#FFE8E8&quot;><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><%
Response.Write( rs.Fields(&quot;Project&quot;) )
%></font></td>
<td height=&quot;14&quot; nowrap width=&quot;33%&quot; bgcolor=&quot;#FFE8E8&quot;><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><%
Response.Write( rs.Fields(&quot;milestone&quot;) )
%></font></td>
</tr>
<%
rs.MoveNext
if rs.eof then
exit do
end if
loop until rs(&quot;project_date&quot;) <> curDate
if rs.eof then
exit do
end if
loop until rs(&quot;company_area_id&quot;) <> curArea
if rs.eof then
exit do
end if
loop until rs.eof
' wend
%>
</table>
 
if I'm not mistaken, your problem is here:
rs.MoveNext
if rs.eof then
exit do
end if
loop until rs(&quot;project_date&quot;) <> curDate
if rs.eof then
exit do
end if
loop until rs(&quot;company_area_id&quot;) <> curArea
if rs.eof then
exit do
end if
loop until rs.eof
you've got the idea mostly right but you have 3 &quot;loops&quot; and only one &quot;do&quot; (further up the page). trying changing where you have loop until rs(&quot;project_date&quot;) etc. to just:

if rs(&quot;project_date&quot;)<> curDate then
exit do
endif

do the same for the company area id then try it. i'm pretty sure that should fix it.
hth
mb
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top