Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2004
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Expected 'End' Help!

    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
    Code:
    <% 
    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>
    Last edited by fishbone34; 01-19-2005 at 02:52 PM.

  • #2
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,065
    Thanks
    4
    Thanked 8 Times in 8 Posts

    you have an if statement with no end if

    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.

    Code:
    <% 
    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>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •