We help IT Professionals succeed at work.
Get Started

If statement breaks loop

Robert Francis
on
219 Views
Last Modified: 2015-02-27
The code below shows two if statements inside of a loop. The first if statement is commented out because when it runs I get the following error:

Microsoft VBScript compilation error '800a040e'
'loop' without 'do'
/portal/routings/routings2.asp, line 108
Loop
^

The second if statement doesn't cause me any problems at all.

<%Do until rs1.EOF %>
	<%'if rs1("expr3") = "Pick" then 
		  'rdate = FormatDateTime("1/1/2100", 0 )
		  'else if rs1("expr3") = "***URGENT***" then 
		  'rdate = FormatDateTime("1/2/1900", 0 )
		  'else if rs1("expr3") = "No Date" then 
		  'rdate = FormatDateTime("1/1/1900", 0 )
		  'else rdate = FormatDateTime(rs1("expr3"), 0 )
		  'end if%>
		
		<%if cdate(rdate) < Date() then 
		cssName = "passed" 
		elseif cdate(rdate) = Date() then
		cssName = "current" 
		else cssName = "future"		
		end if 
		response.write cssName 'Just a test to see if it works
		%>
        
    <tr class="cssName">
      <td><%Response.Write rs1("expr2")%></td>
      <td><a href="/portal/invoicing/jobcostdetail.asp?job=<%Response.Write rs1("job")%>" target="_blank">
        <%Response.Write rs1("job")%>
        </a></td>
      <td><%Response.Write rs1("customer")%></td>
      <td><%Response.Write rs1("Part_Number")%></td>
      <td><%Response.Write rs1("Description")%></td>
      <td><%Response.Write rs1("Rev")%></td>
      <td><%Response.Write rs1("Promised_Quantity")%>/<%Response.Write rs1("Order_Unit")%></td>
      <td><%if rs1("EXPR1") = "S" then Response.Write "Started" else Response.Write "Open"%></td>
      <td><%Response.Write rs1("est_total_hrs")%></td>
      <td><%Response.Write rs1("Comment")%></td>
      <td><%Response.Write FormatDateTime(rs1("expr3"), 0 )%></td>
    </tr>
<%rs1.MoveNext()
Loop%>

Open in new window


As a bonus for me how can I get the value of cssName created in the second if statement and put it in a <tr> class on line 20 of the code?

Thanks for any help in advance.
Comment
Watch Question
Web Ninja at large
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE