0
votes

I can not figure out why I am getting this error message: Microsoft VBScript compilation error '800a03f6' Expected 'End' /itemlookup.asp, line 133 Here is my entire code. Can anyone help me out? Down near the bottom there is the End If

and that is where it is giving me the error. I put the entire code down below.

 <style type="text/css" href="test.css"> </style>

</head>


<form method="get" action="itemlookup.asp" > 
<p>
Barcode 1: 
<input type="text" name="barcode1" >
</p>
<p>Locator:
<input type="text" name="locator" >
</p>
<input type="submit" value="Run Request">
<tr> <input type="button" value="New Search" onclick="submit()"/></tr>
</form>



<%


 dim barcode1
 barcode1=Request.QueryString("barcode1") 
 dim locator
 locator=Request.QueryString("locator") 

  set conn=Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
Conn.Open "Provider=SQLNCLI10;Server=XX.XX.XX.X;Database=XXXXXX;Uid=XXX; Pwd=XXX;"



 If barcode1<>"" Then 
response.write "<b><h4>" & UCASE(barcode1) & " - Picking History Report - " & time & "</h4></b>"
else If locator<>"" Then 
response.write "<b><h4>" & UCASE(barcode1) & " - Picking History Report - " & time & "</h4></b>"



            sql ="select top 1" _
                                + " INVENTORY.ITEM_CODE as Item_Code," _ 
                + "DELIVERIES_PICKS.description as description," _
                                + "INVENTORY.LOCATOR_CODE as locator," _
                                + "INVENTORY.QTY as qty " & _
                                " FROM INVENTORY JOIN deliveries_picks ON DELIVERIES_PICKS.item_code = INVENTORY.item_code JOIN deliveries_picks_hist ON DELIVERIES_PICKS.item_code = DELIVERIES_PICKS_hist.item_code WHERE DELIVERIES_PICKS_hist.barcode1 = '"+ barcode1 +" or where INVENTORY.LOCATOR_CODE = '" + locator + "' 'group by INVENTORY.LOCATOR_CODE, INVENTORY.ITEM_CODE, DELIVERIES_PICKS.description, INVENTORY.QTY, DELIVERIES_PICKS.barcode1, DELIVERIES_PICKS.barcode2, INVENTORY.QTY, DELIVERIES_PICKS_hist.barcode1, DELIVERIES_PICKS_hist.barcode2"





    rs.Open sql,conn

    end If


    %>
<style type="text/css">
table {font-size: 85%;}
th {font-size: 17; font-family: Clarendon Extended;}

body
{
background-color:;
}


</style>
<table border="1%" width="1%" >
  <tr>
  <font size="10" > <%
  If barcode1<>""  Then 

  for each x in rs.Fields
    response.write("<th><b>" & UCASE(x.name) & "</b></th>")
  next%>
  </tr>
  <%do until rs.EOF%>
    <tr>
    <%for each x in rs.Fields%>
      <td><%Response.Write("<b>" & x.value)%></td>
    <%next
    rs.MoveNext%>
    </tr>
  <%loop
  rs.close
  conn.close

ElseIf  locator<>"" Then 

  for each x in rs.Fields
    response.write("<th><b>" & UCASE(x.name) & "</b></th>")
  next%>
  </tr>
  <%do until rs.EOF%>
    <tr>
    <%for each x in rs.Fields%>
      <td><%Response.Write("<b>" & x.value)%></td>
    <%next
    rs.MoveNext%>
    </tr>
  <%loop
  rs.close
  conn.close

  End If

  %>
</table></font> 


</body>
</html>
1
That is some nasty VBScript there. There doesn't seem to be 133 lines in that code (I count 113), have you pasted it all in? - garryp
Yeah it is the last end if statement near the bottom. - Tommy Graffam
You're using four different languages, all in one document? And they're not HTML/Javascript/CSS/PHP? Impressive. - Fund Monica's Lawsuit
You could do with tidy up the code then you might be able to make head and tail of it. - user692942

1 Answers

1
votes

You have a space between elseif here:

If barcode1<>"" Then 
    response.write "<b><h4>" & UCASE(barcode1) & " - Picking History Report - " & time & "</h4></b>"
else If locator<>"" Then 
    response.write "<b><h4>" & UCASE(barcode1) & " - Picking History Report - " & time & "</h4></b>"

it should be

ElseIf locator <> "" Then