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

Error: Expected 'End' 1

Status
Not open for further replies.
Mar 4, 2001
43
US
Okay, I'm stumped. This is real simple stuff, but I can't find the error and need another pair of eyes. Getting error "Microsoft VBScript compilation error '800a03f6'|Expected 'End'|/it/timesheet2.asp, line 110" Line 110 is the line at the end terminating the ADO connection. I've been looking for an unterminated 'If...then' or Loop, but I must be missing it. Help would be greatly appreciated.
Code:
<html>
<head>
<%@ Language=VBScript %>

<%
dim UID
	if Request.QueryString("UID")="" then
		empFilter = ""
	else
		UID = Request.QueryString("UID")
		empFilter = "tTimeEntry.EmployeeID=" & cInt(UID) & " AND " 
	End If

	Dim pStart
		if Request.QueryString("pStart")="" then
		pStart = Now-7
	else
		pStart = Request.QueryString("pStart")
	End If

dim inputSQL1
inputSQL1 = "SELECT tTimeEntry.EmployeeID, tTimeEntry.Date, tTimeEntry.ProjectID, tTimeEntry.DesignCode, tTimeEntry.Description, tTimeEntry.Hours, tTimeEntry.Mileage, tTimeEntry.Class FROM tTimeEntry WHERE " & empFilter & "tTimeEntry.Date>=#" & pStart & "# ORDER BY tTimeEntry.Date;"

inputSQL2 = "SELECT DISTINCT tEmployeeID.EmployeeID, tEmployeeID.EmployeeFirst, tEmployeeID.EmployeeLast FROM tEmployeeID WHERE tEmployeeID.EmployeeID>0;"

Function writeTable()
	Dim color
	
	Response.Write "<table cellpadding='5' cellspacing='1' bgcolor='#C0C0C0' border='0' width='90%' height='50'>"
	Response.Write "<tr><td  align='center'><font face='Calisto MT'>Emp ID</font></td>"
	Response.Write "<td align='center'><font face='Calisto MT'>Project Num</font></td>"
	Response.Write "<td align='center'><font face='Calisto MT'>Date</font></td>"
	Response.Write "<td align='center'><font face='Calisto MT'>Design Code</font></td>"
	Response.Write "<td align='center'><font face='Calisto MT'>Work Class</font></td>"
	Response.Write "<td align='center'><font face='Calisto MT'>Description</font></td>"
	Response.Write "<td align='center'><font face='Calisto MT'>Hours</font></td>"
	Response.Write "<td align='center'><font face='Calisto MT'>Miles</font></td></tr>"

	rs1.Movefirst
	color = "#FFFFFF"
	Do while not rs1.EOF
		Response.Write "<tr><td width='72' bgcolor=" & color & " align='center'>" & rs1(0) & "</td>"
		Response.Write "<td width='76' bgcolor=" & color & " align='center'>" & rs1(2) & "</td>"
		Response.Write "<td width='48' bgcolor=" & color & " align='center'>" & rs1(1) & "</td>"
		Response.Write "<td width='35' bgcolor=" & color & " align='center'>" & rs1(3) & "</td>"
		Response.Write "<td width='42' bgcolor=" & color & " align='center'>" & rs1(7) & "</td>"
		Response.Write "<td width='773' bgcolor=" & color & " align='left'><i>" & rs1(4) & "</i></td>"
		Response.Write "<td width='37' bgcolor=" & color & " align='center'>" & rs1(5) & "</td>"
		Response.Write "<td height='24' width='33' bgcolor=" & color & " align='center'>" & rs1(6) & "</td></tr>"
	
		If color="#FFFFFF" then
			color="#C0C0C0"
		else
			color = "#FFFFFF"
		end if
	
		rs1.MoveNext
	Loop
	
	Response.Write "</table>"
End Function
%>
<!--#include file="connection.asp"-->
<!--#include File="RS1.asp"-->
<!--#include File="RS2.asp"-->
<script language="javascript" src="popup_calendar/script.js" type="text/javascript"></script>
<Title>Ray's Test Time Entry Page</title>
</head>

<body>
<div align="center">
	<form name="setParam" method="Get" action="timesheet.asp">
		<p><font face="Calisto MT">Employee ID: 
		<select size="1" name="UID">
		<option value=""></option>
		<%
		RS2.MoveFirst
		
		Do While Not RS2.EOF
			Response.Write "<option value=" & RS2(0) & ">" & RS2(0) & "|" & RS2(1) & " " & RS2(2) &"</option>"
			RS2.MoveNext
		Loop
		
		RS2.Close
		Set RS2 = Nothing
		%>
		</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Period Start Date:
		<input type="text" name="pStart" size="20" id="pStt"><a href="javascript:OpenCalendar('pStart', false)"><img height="16" src="popup_calendar/icon-calendar.gif" width="24" align="absMiddle" border="0" /></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></font></p>
	</form>
	</div>

<div align="center">
<%
IF rs1.eof = true then
	Response.Write "<font face='Calisto MT'>No Records Found for User " & UID & " for the period starting on " & pStart & ".</font>"
else if isnull(UID) then
	Response.Write "<font face='Calisto MT'>Records for all users for the period starting on " & pStart & ".</font><br>"
	writeTable()
Else
	Response.Write "<font face='Calisto MT'>Records for User " & UID & " for the period starting on " & pStart & ".</font><br>"
	writeTable()
End If

rs1.Close
Set rs1 = Nothing
%>

<%
conn.Close
Set conn = Nothing
%>

</body>
</html>
 
Yeah, the includes are just reusable chunks that build the default connection and recordset(s). I'm using the same includes in other pages w/o issue. And I double checked them just to be sure.
 
You are opening two 'If's and only closing one. You may have not realised that Else If is also an If. Try:
Code:
IF rs1.eof = true then
    Response.Write "<font face='Calisto MT'>No Records Found for User " & UID & " for the period starting on " & pStart & ".</font>"
else if isnull(UID) then
    Response.Write "<font face='Calisto MT'>Records for all users for the period starting on " & pStart & ".</font><br>"
    writeTable()
Else
    Response.Write "<font face='Calisto MT'>Records for User " & UID & " for the period starting on " & pStart & ".</font><br>"
    writeTable()
[COLOR=red]End If[/color]
End If

rs1.Close
Set rs1 = Nothing

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
actually that's right and possibly wrong at the same time [smile]

John is absolutely correct in that the way you have written it, (with a space between "else" & "if"). It does need the extra "end if"

but if you meant to use "elseif" (without the space) it doesn't.



< Now why didn't I spot that one [banghead] (goes off muttering into the distance) >

Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
...but if you meant to use "elseif" (without the space) it doesn't."

And I did. As well as muttering off into the distance when I realized I was stumped by a misplaced space. You guys rock. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top