...

View Full Version : Expected 'End' Help!



fishbone34
01-19-2005, 02:48 PM
Hello, I'm new to this.

I get this error when I run this ASP page:

Error Type:
Microsoft VBScript compilation (0x800A03F6)
Expected 'End'
/t1/database/perfmgmt/newsite/manager/reports/comments/edit/editcomments.asp, line 142

--------------------------------

The Page: LINE 142 is in BOLD and RED

<%
login=Request.Cookies("login")
if login <> "2" THEN
Response.Write("<script>window.open('http://xxxxxx-xxxx/t1/database/perfmgmt/newsite/login.html','basefrm');</script>")
end if

%>
<html>
<head>
<title>Monthly Performance Review Comments</title>
<meta name="keywords" content="DoNotBrowse">
<!-->
<script language = "javascript">
<!--
function checkMandatory()
{
var error_string = "";
//problem description must be < 2000 char
var problem = window.document.editcomm.monthlycomments.value;

if (problem.charAt(2000) != "") {
error_string += "Monthly Comments size excedes maximum size.\n"; }

//problem description must be < 2000 char
var problem = window.document.editcomm.achievements.value;

if (problem.charAt(2000) != "") {
error_string += "Achievements Comments size excedes maximum size.\n"; }

//problem description must be < 2000 char
var problem = window.document.editcomm.improve_op.value;

if (problem.charAt(2000) != "") {
error_string += "Improvement Opportunities comments size excedes maximum size.\n"; }

if (error_string == "")
return true;
else{
error_string = "We found the following errors in your form: \n" + error_string;
alert(error_string);
return false; }
}
//end checkMandatory

// end hide -->
</script>
</head>

<body bgcolor="#ffffff">
<%

theDate = request.form("theDate")
Agent = request.form("Agent")
themonth = request.form("month")
theYear = request.form("theYear")
reviewer = request.form("monitors")

if theMonth <> "" THEN

'Get all entries in the database for the Agent for the entire month
months = theMonth
years = theYear 'all dates must be less than 31, even if there aren't 31 days in every month!

'Connect to database to upload all form data.
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=SQLOLEDB;Data Source=xx.xx.xx.xx;database=PerformanceManagement;uid=xx;pwd=xxxxxxx;"

'Get Phone_ID of the Agent from their name
nameArray = split(Agent,",")
lname = nameArray(0)
fname = nameArray(1)
query1 = "Select Phone_Id from tb_Employee where last_name = '"&lname&"' and first_name = '"&fname&"'"
set objRS=Conn.execute(query1)
Phone_Id = objRS("Phone_ID")

query1 = "Select dated,Phone_id,First_name,Last_name,Monthlycomments,improve_op,achievements from monthly_agentNEW where phone_id = '"&Phone_Id&"' and DATED = '"&months&""&years&"'"
set objRS=Conn.execute(query1)
DATED = objRS("DATED")
First_Name = objRS("First_Name")
Last_Name = objRS("Last_Name")
monthlycomments = objRS("monthlycomments")
achievements = objRS("achievements")
improve_op = objRS("improve_op")
Phone_Id = objRS("Phone_Id")
objRS.MoveNext
' WEND
objRS.Close
conn.close
%><BR> <form name = "editcomm" action = "editcomments2.asp" method = "post"
onSubmit="var the_result = checkMandatory(); return the_result;">
<center>
<table width="670">
<td width="16%"><font size="2" face="Arial"><b>Agent Name: </b></font>:</td>
<td width="16%"><input type="text" name="Agent" readonly size="23" value="<%=First_Name%>,<%=Last_Name%>"></td>
</tr>
<td width="16%"><font size="2" face="Arial"><b>Agent Last Name:</b></font>:</td>
<td width="16%"><input type="text" name="Monitor" readonly size="25" value="<%=Last_Name%>"></td>
</tr>
<td width="16%"><font size="2" face="Arial"><b>Date:</b></font>:</td>
<td width="16%"><input type="text" name="dated" readonly size="10" value="<%=dated%>"></td>
</tr>
<td width="16%"><font size="2" face="Arial"><b>Phone Id</b></font>:</td>
<td width="16%"><input type="text" name="Phone_id" readonly size="10" value="<%=Phone_id%>"></td>
</tr>
</table>
</center>
<br>
<br>
<center>
<input type="submit" value="Submit"></center>
<br>
<br>
<font size="3" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>INTRODUCTION:</b></font>
<center>
<table width="670">
<tr>
<td><font size="2" face="Arial">MONTHLY COMMENTS:</font></td>
<td><textarea name="Monthlycomments" rows=5 cols=60><%=Monthlycomments%></textarea></td>
</tr>
</table>
</center>
<hr>
<br>
<br>
<font size="3" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>IMPROVEMENT OPPORTUNITIES:</b></font>
<center>
<table width="670">
<tr>
<td><font size="2" face="Arial">Comments:</font></td>
<td><textarea name="improve_op" rows=5 cols=60><%=improve_op%></textarea></td>
</tr>
</table>
</center>
<hr>
<br>
<br>
<font size="3" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>ACHIEVEMENTS:</b></font>
<center>
<table width="670">
<tr>
<td><font size="2" face="Arial">Comments:</font></td>
--->LINE 142 <td><textarea name="achievements" rows=5 cols=60><%=achievements%></textarea></td>
</tr>
</table>
</center>
<hr>
<br>
<br>
<br>
<center>
<input type="submit" value="Submit"></center>
</form>
<BR>
</a></font>


</BODY>
</HTML>

miranda
01-19-2005, 07:44 PM
No end if to the if statement in red. It is important to always indent your code!!!!! you do it in html, it is even more helpful to do so when programming.



<%
login=Request.Cookies("login")
if login <> "2" THEN
Response.Write("<script>window.open('http://xxxxxx-xxxx/t1/database/perfmgmt/newsite/login.html','basefrm');</script>")
end if

%>
<html>
<head>
<title>Monthly Performance Review Comments</title>
<meta name="keywords" content="DoNotBrowse">
<!-->
<script language = "javascript">
<!--
function checkMandatory()
{
var error_string = "";
//problem description must be < 2000 char
var problem = window.document.editcomm.monthlycomments.value;

if (problem.charAt(2000) != "") {
error_string += "Monthly Comments size excedes maximum size.\n"; }

//problem description must be < 2000 char
var problem = window.document.editcomm.achievements.value;

if (problem.charAt(2000) != "") {
error_string += "Achievements Comments size excedes maximum size.\n"; }

//problem description must be < 2000 char
var problem = window.document.editcomm.improve_op.value;

if (problem.charAt(2000) != "") {
error_string += "Improvement Opportunities comments size excedes maximum size.\n"; }

if (error_string == "")
return true;
else{
error_string = "We found the following errors in your form: \n" + error_string;
alert(error_string);
return false; }
}
//end checkMandatory

// end hide -->
</script>
</head>

<body bgcolor="#ffffff">
<%

theDate = request.form("theDate")
Agent = request.form("Agent")
themonth = request.form("month")
theYear = request.form("theYear")
reviewer = request.form("monitors")

if theMonth <> "" THEN

'Get all entries in the database for the Agent for the entire month
months = theMonth
years = theYear 'all dates must be less than 31, even if there aren't 31 days in every month!

'Connect to database to upload all form data.
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=SQLOLEDB;Data Source=xx.xx.xx.xx;database=PerformanceManagement;uid=xx;pwd=xxxxxxx;"

'Get Phone_ID of the Agent from their name
nameArray = split(Agent,",")
lname = nameArray(0)
fname = nameArray(1)
query1 = "Select Phone_Id from tb_Employee where last_name = '"&lname&"' and first_name = '"&fname&"'"
set objRS=Conn.execute(query1)
Phone_Id = objRS("Phone_ID")

query1 = "Select dated,Phone_id,First_name,Last_name,Monthlycomments,improve_op,achievements from monthly_agentNEW where phone_id = '"&Phone_Id&"' and DATED = '"&months&""&years&"'"
set objRS=Conn.execute(query1)
DATED = objRS("DATED")
First_Name = objRS("First_Name")
Last_Name = objRS("Last_Name")
monthlycomments = objRS("monthlycomments")
achievements = objRS("achievements")
improve_op = objRS("improve_op")
Phone_Id = objRS("Phone_Id")
objRS.MoveNext
' WEND
objRS.Close
conn.close
%><BR> <form name = "editcomm" action = "editcomments2.asp" method = "post"
onSubmit="var the_result = checkMandatory(); return the_result;">
<center>
<table width="670">
<td width="16%"><font size="2" face="Arial"><b>Agent Name: </b></font>:</td>
<td width="16%"><input type="text" name="Agent" readonly size="23" value="<%=First_Name%>,<%=Last_Name%>"></td>
</tr>
<td width="16%"><font size="2" face="Arial"><b>Agent Last Name:</b></font>:</td>
<td width="16%"><input type="text" name="Monitor" readonly size="25" value="<%=Last_Name%>"></td>
</tr>
<td width="16%"><font size="2" face="Arial"><b>Date:</b></font>:</td>
<td width="16%"><input type="text" name="dated" readonly size="10" value="<%=dated%>"></td>
</tr>
<td width="16%"><font size="2" face="Arial"><b>Phone Id</b></font>:</td>
<td width="16%"><input type="text" name="Phone_id" readonly size="10" value="<%=Phone_id%>"></td>
</tr>
</table>
</center>
<br>
<br>
<center>
<input type="submit" value="Submit"></center>
<br>
<br>
<font size="3" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>INTRODUCTION:</b></font>
<center>
<table width="670">
<tr>
<td><font size="2" face="Arial">MONTHLY COMMENTS:</font></td>
<td><textarea name="Monthlycomments" rows=5 cols=60><%=Monthlycomments%></textarea></td>
</tr>
</table>
</center>
<hr>
<br>
<br>
<font size="3" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>IMPROVEMENT OPPORTUNITIES:</b></font>
<center>
<table width="670">
<tr>
<td><font size="2" face="Arial">Comments:</font></td>
<td><textarea name="improve_op" rows=5 cols=60><%=improve_op%></textarea></td>
</tr>
</table>
</center>
<hr>
<br>
<br>
<font size="3" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>ACHIEVEMENTS:</b></font>
<center>
<table width="670">
<tr>
<td><font size="2" face="Arial">Comments:</font></td>
--->LINE 142 <td><textarea name="achievements" rows=5 cols=60><%=achievements%></textarea></td>
</tr>
</table>
</center>
<hr>
<br>
<br>
<br>
<center>
<input type="submit" value="Submit"></center>
</form>
<BR>
</a></font>


</BODY>
</HTML>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum