I have a page that populates a drop down form a DB table. which works. On clicking edit record i am trying to load the record values into the form2 below. I checked if the record ID is being passed via a seperate asp page. this works. however i am getting the error above, and cant work it out. and help would be much appreciated. Thankd
<!--#include virtual="/includes/connection.asp" -->
<%
'------------------------------------------------------------------------------
'--- Variables
'------------------------------------------------------------------------------
Dim RS,RS1,strSQL,strSQL1
Set RS = Server.CreateObject("ADODB.Recordset")
Set RS1 = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblclients.* FROM tblclients"
strSQL1 = "SELECT tblclients.* FROM tblclients WHERE ID=" & (recID)
RS.Open strSQL, conn
%>
<!--'------------------------------------------------------------------------------
'--- Start of Customer Select form
'---------------------------------------------------------------------------------->
<html>
<form name="selcust" class="fldheaders" action="tst_lst.asp" method="post">
<table align="center" class="tblbg" width="500" cellpadding="2" cellspacing="0">
<tr>
<td align="center">Select Customer to edit: <SELECT name="Customer">
<option selected>
<% Do While Not RS.EOF
Response.Write("<OPTION value=""" & RS("ID") & """>" & RS("company") & "</option>")
RS.MoveNext
Loop
recID = Request.Form("customer")
Sub edit_onclick
'strSQL1 = "SELECT tblclients.* FROM tblclients WHERE ID=" & (recID)
RS1.Open strSQL1, conn
End Sub
%>
</select>
<INPUT TYPE="BUTTON" name="edit" value="Edit Record">
</td>
</tr>
</table>
</form>
</html>
<!------------------------------------------------------------------------------
'--- End of Customer Select form
'------------------------------------------------------------------------------>
<!------------------------------------------------------------------------------
'--- Record Details Form
'--------------------------------------------------------------------------------->
<html>
<head>
<title>Add New Customer Record</title>
<style type="text/css">
<!------------------------------------------------------------------------------
'--- CSS Start
'------------------------------------------------------------------------------->
<!--
.headings {
font-family: "Arial";
font-size: 14pt;
font-weight: bold;
color: #000000;
}
.tblheaders {
font-family: "Verdana";
font-size: 9pt;
font-weight: bold;
color: #FFFFFF;
background-color: #000099;
}
.fldheaders {
font-family: "Verdana"; font-size: 9pt;
font-weight: bold;
color: #797979;
}
.flds {
font-family: "Verdana";
font-size: 9pt;
font-weight: normal;]
bordercolor-color: #ffffff;
}
.bgwhite {
background-color: #FFFFFF;
bordercolor-color: #ffffff;
}
.tblbg {
font-family: "Verdana";
font-size: 9pt;
font-weight: bold;
color: #797979;
background-color: #ffffff;
bordercolor-color: #ffffff;
border: 0;
}
.aligncenter {
align: center;
}
-->
<!------------------------------------------------------------------------------
'--- CSS End
'--------------------------------------------------------------------------------->
</style>
</head>
<form name="addcust" action="customer_add.asp" method="post">
<br>
<table bgcolor="F4F4F4" bordercolor="#ffffff" cols="2" border="1" cellpadding="2" cellspacing="0"align="center">
<tr>
<th class="tblheaders" COLSPAN=2 height="30">Update Record</th>
</tr>
<tr>
<td width="150" align="right" class="fldheaders">Company Name:</td>
<td width="350" align="left"><input name="company" type="text" size="50" class="flds" value="<%=RS("company")%>"></td>
</tr>
<tr>
<td width="150" align="right" class="fldheaders">Contact Name:</td>
<td width="350" align="left"><input name="contact" type="text" size="35" class="flds" value="<%=RS("contact")%>"></td>
</tr>
<tr>
<td width="150" align="right" class="fldheaders">Address:</td>
<td width="350" align="left"><input name="address" type="text" size="50" class="flds" value="<%=RS("address")%>"></td>
</tr>
<tr>
<td width="150" align="right" class="fldheaders">Tel No:</td>
<td width="350" align="left"><input name="phone" type="text" size="25" class="flds" value="<%=RS("phone")%>"></td>
</tr>
<tr>
<td width="150" align="right" class="fldheaders">Account Manager</td>
<td width="350" align="left"><input name="accmgr" type="text" size="35" class="flds" value="<%=RS("accmgr")%>"></td>
</tr>
<tr>
<td width="150" align="right" class="fldheaders" valign="hor">Comments</td>
<td width="350" align="left"><textarea name="notes" cols="40" rows="5" class="flds">value="<%=RS("notes")%>"></textarea></td>
</tr>
<tr>
<td width="150" class="tblbg"></td>
<td width="350" class="tblbg" align="left"><br><input name="cancel" type="reset" id="cancel" value="Cancel">
<input name="add" type="submit" id="add" value="Add Record">
</td>
</tr>
</table>
<br>
<hr size="1" width="550" align="center" color="#003399">
</form>
</html>
<!------------------------------------------------------------------------------
'--- End of Record Details Form
'--------------------------------------------------------------------------------->
<!------------------------------------------------------------------------------
'--- Closes Open Recordset
'--------------------------------------------------------------------------------->
<%
RS.Close
Set RS = Nothing
RS1.Close
Set RS1=Nothing
Set conn = Nothing
%>
<!--#include virtual="/includes/connection.asp" -->
<%
'------------------------------------------------------------------------------
'--- Variables
'------------------------------------------------------------------------------
Dim RS,RS1,strSQL,strSQL1
Set RS = Server.CreateObject("ADODB.Recordset")
Set RS1 = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblclients.* FROM tblclients"
strSQL1 = "SELECT tblclients.* FROM tblclients WHERE ID=" & (recID)
RS.Open strSQL, conn
%>
<!--'------------------------------------------------------------------------------
'--- Start of Customer Select form
'---------------------------------------------------------------------------------->
<html>
<form name="selcust" class="fldheaders" action="tst_lst.asp" method="post">
<table align="center" class="tblbg" width="500" cellpadding="2" cellspacing="0">
<tr>
<td align="center">Select Customer to edit: <SELECT name="Customer">
<option selected>
<% Do While Not RS.EOF
Response.Write("<OPTION value=""" & RS("ID") & """>" & RS("company") & "</option>")
RS.MoveNext
Loop
recID = Request.Form("customer")
Sub edit_onclick
'strSQL1 = "SELECT tblclients.* FROM tblclients WHERE ID=" & (recID)
RS1.Open strSQL1, conn
End Sub
%>
</select>
<INPUT TYPE="BUTTON" name="edit" value="Edit Record">
</td>
</tr>
</table>
</form>
</html>
<!------------------------------------------------------------------------------
'--- End of Customer Select form
'------------------------------------------------------------------------------>
<!------------------------------------------------------------------------------
'--- Record Details Form
'--------------------------------------------------------------------------------->
<html>
<head>
<title>Add New Customer Record</title>
<style type="text/css">
<!------------------------------------------------------------------------------
'--- CSS Start
'------------------------------------------------------------------------------->
<!--
.headings {
font-family: "Arial";
font-size: 14pt;
font-weight: bold;
color: #000000;
}
.tblheaders {
font-family: "Verdana";
font-size: 9pt;
font-weight: bold;
color: #FFFFFF;
background-color: #000099;
}
.fldheaders {
font-family: "Verdana"; font-size: 9pt;
font-weight: bold;
color: #797979;
}
.flds {
font-family: "Verdana";
font-size: 9pt;
font-weight: normal;]
bordercolor-color: #ffffff;
}
.bgwhite {
background-color: #FFFFFF;
bordercolor-color: #ffffff;
}
.tblbg {
font-family: "Verdana";
font-size: 9pt;
font-weight: bold;
color: #797979;
background-color: #ffffff;
bordercolor-color: #ffffff;
border: 0;
}
.aligncenter {
align: center;
}
-->
<!------------------------------------------------------------------------------
'--- CSS End
'--------------------------------------------------------------------------------->
</style>
</head>
<form name="addcust" action="customer_add.asp" method="post">
<br>
<table bgcolor="F4F4F4" bordercolor="#ffffff" cols="2" border="1" cellpadding="2" cellspacing="0"align="center">
<tr>
<th class="tblheaders" COLSPAN=2 height="30">Update Record</th>
</tr>
<tr>
<td width="150" align="right" class="fldheaders">Company Name:</td>
<td width="350" align="left"><input name="company" type="text" size="50" class="flds" value="<%=RS("company")%>"></td>
</tr>
<tr>
<td width="150" align="right" class="fldheaders">Contact Name:</td>
<td width="350" align="left"><input name="contact" type="text" size="35" class="flds" value="<%=RS("contact")%>"></td>
</tr>
<tr>
<td width="150" align="right" class="fldheaders">Address:</td>
<td width="350" align="left"><input name="address" type="text" size="50" class="flds" value="<%=RS("address")%>"></td>
</tr>
<tr>
<td width="150" align="right" class="fldheaders">Tel No:</td>
<td width="350" align="left"><input name="phone" type="text" size="25" class="flds" value="<%=RS("phone")%>"></td>
</tr>
<tr>
<td width="150" align="right" class="fldheaders">Account Manager</td>
<td width="350" align="left"><input name="accmgr" type="text" size="35" class="flds" value="<%=RS("accmgr")%>"></td>
</tr>
<tr>
<td width="150" align="right" class="fldheaders" valign="hor">Comments</td>
<td width="350" align="left"><textarea name="notes" cols="40" rows="5" class="flds">value="<%=RS("notes")%>"></textarea></td>
</tr>
<tr>
<td width="150" class="tblbg"></td>
<td width="350" class="tblbg" align="left"><br><input name="cancel" type="reset" id="cancel" value="Cancel">
<input name="add" type="submit" id="add" value="Add Record">
</td>
</tr>
</table>
<br>
<hr size="1" width="550" align="center" color="#003399">
</form>
</html>
<!------------------------------------------------------------------------------
'--- End of Record Details Form
'--------------------------------------------------------------------------------->
<!------------------------------------------------------------------------------
'--- Closes Open Recordset
'--------------------------------------------------------------------------------->
<%
RS.Close
Set RS = Nothing
RS1.Close
Set RS1=Nothing
Set conn = Nothing
%>