INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Have I got too many if's

Have I got too many if's

(OP)
Hi All

One of my pages stopped working today with the error

Active Server Pages error 'ASP 0127'
Missing close of HTML comment
/Lawn/lawnprog/Print_invoices.asp, line 497
The HTML comment or server-side include lacks the close tag (-->).

I removed code until the page worked and then added code back until it failed. The code that worked is

CODE

<%
if designRS("Pay_Method") = "Yes" then %>
    <tr><td style="border:0"><%=designRS("Pay_Method_Text")%></td></tr>
    <%
    if designRS("Pay_Cash") = "Yes" then %>
       <tr><td style="border:0">•  Cash</td></tr>
    <%end if
    
    if designRS("Pay_Bacs") = "Yes" then %>
        <tr><td style="border:0">•  Bacs: <%=CompanyRS("Bacs_No") %></td></tr>
    <%end if
    
    if designRS("Pay_Online") = "Yes" then %>
        <tr><td style="border:0">•  Online Payment: <%=CompanyRS("Bacs_No") %></td></tr>
        <tr><td style="border:0">        (Please use your customer number '<%=BookingRS("CustID")%>' as your reference)</td></tr>
    <%end if
end if %> 

I then added another IF like this

CODE

<%
if designRS("Pay_Method") = "Yes" then %>
    <tr><td style="border:0"><%=designRS("Pay_Method_Text")%></td></tr>
    <%
    if designRS("Pay_Cash") = "Yes" then %>
       <tr><td style="border:0">•  Cash</td></tr>
    <%end if
    
    if designRS("Pay_Bacs") = "Yes" then %>
        <tr><td style="border:0">•  Bacs: <%=CompanyRS("Bacs_No") %></td></tr>
    <%end if
    
    if designRS("Pay_Online") = "Yes" then %>
        <tr><td style="border:0">•  Online Payment: <%=CompanyRS("Bacs_No") %></td></tr>
        <tr><td style="border:0">        (Please use your customer number '<%=BookingRS("CustID")%>' as your reference)</td></tr>
    <%end if

    if designRS("Pay_Cheque") = "Yes" then %>
       <tr><td style="border:0">jjkjdsfkjsdkjflskdlj</td></tr>
       <tr><td style="border:0">        </td></tr>
    <%end if  


end if %> 
And it fails with the above error message! I have not changed this code for several months and the error does not seem to relate to the new code.

Any ideas please

RE: Have I got too many if's

Rather than all those if then .. end if use a

select case .... case ... end case structure

Or

if then ... elseif then ... end if structure

( http://www.w3schools.com/vbscript/vbscript_conditi... )


Note the lack of space between else & if in elseif as it is a continuation of the if .. then rather than a separate if ... then construct.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: Have I got too many if's

Which line is 497?

RE: Have I got too many if's

Does any of your data (Pay_Method_Text, Bacs_no, CustID) happen to be --

RE: Have I got too many if's

it looks like your problem outside of your published code...
look on commented html...

RE: Have I got too many if's

Instead of writing the field values directly likle this:

CODE

<%=CompanyRS(... 

Use HTMLEncode:

CODE

<%=Server.HTMLEncode(CompanyRS(... 

This way you should be safe from accidental HTML misinterpretation.

Cheers,
MakeItSo

ôKnowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.ö (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close