If statement breaks loop

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.
Robert FrancisDirector of Continuous ImprovementAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Big MontyWeb Ninja at largeCommented:
try changing line 30 (from the code snippet) from

<td><%if rs1("EXPR1") = "S" then Response.Write "Started" else Response.Write "Open"%></td>

to

<td><%if rs1("EXPR1") = "S" then Response.Write "Started" else Response.Write "Open"%> <%end if %></td>

if that doesn't work, can you confirm that line 108 (from your own code base) is listed above? you could also, as a test, comment out that entire block and see if you get the error. If you don't, that tells us it's somewhere else in the code
Robert FrancisDirector of Continuous ImprovementAuthor Commented:
That didn't make a difference. Line 108 is line 36 in the code base.
Robert FrancisDirector of Continuous ImprovementAuthor Commented:
This is really weird the more I look at it. It is definitely something in the commented out code that is the first if statement.
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Robert FrancisDirector of Continuous ImprovementAuthor Commented:
I figured out the first part of my problem. The else and if was two separate words in lines 4 and 6. Any idea on the bonus question?
Big MontyWeb Ninja at largeCommented:
i believe the first part of your question is due to the fact that your closing ASP tag ( %> ) was commented out. either way glad you got it working :)

for the second part of your question, do the following:

<tr class="<%=cssName%>">

just a FYI, <%= is shorthand for Response.Write

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Robert FrancisDirector of Continuous ImprovementAuthor Commented:
Awesome on the FYI.

I figured it out by uncommenting lines 2,3,8 and 9 and it worked. That told with the else if's were the problem. I then made them elseif and it worked.

Once again you are the man Big Monty!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.