Hi,
I got 2 form etry.asp and clform.asp, the user key in in etry.asp,
then the information will be stored in table' details'. User key in SO
number in clform.asp will capture data from table 'details' and after
user update CEtechid etc, it will be stored in table' clnform'.
The
etry.asp form got no problem, the record can be save in table
'details', the clform.asp can capture data from table 'details', but
when I click 'save', it will prompt the record has been saved, but the
record does not update in table clnform. Thanks in advance.
This is my
etry.asp 1
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Accessories Data Entry Form</title>
<meta name="Microsoft Theme" content="journal 1011, default">
</head>
<body>
<FORM NAME = "etry" ACTION = "etry.asp" METHOD="post" ALIGN="center">
<%
Dim v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,FilePath,co nn,strSql,rs,msg,strValue
on error resume next
v1 = Request.Form.Item("SoNo")
v2 = Request.Form.Item("Mno")
msg=""
strValue=Request.Form.Item("HidText")
if (strvalue="PullRecord") then
if (trim(v1)<>Empty) then
Filepath = "F:\Inetpub\abc\fpdb\Accessories.mdb"
'FilePath=server.MapPath("Accessories.mdb")
set conn=server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FilePath
strsql = "select * from details where sono = '" & trim(v1) & "'"
set rs = conn.Execute(strsql)
if not rs.Eof then
v1 = rs(0) & ""
v2 = rs(1) & ""
v3 = rs(2) & ""
v4 = rs(3) & ""
v5 = rs(4) & ""
v6 = rs(12) & ""
v7 = rs(13) & ""
v8 = rs(14) & ""
v9 = rs(7) & ""
v10 = rs(15) & ""
v11 = rs(8) & ""
v12 = rs(11) & ""
else
msg="<br> No Record were Found............"
v2=""
end if
' rs.close
' conn.close
else
msg="<br> No Record were Found............"
end if
else if (strvalue="AdRecord") then
if (trim(v1)<>Empty and trim(v2)<>Empty) then
Filepath = "F:\Inetpub\abc\fpdb\Accessories.mdb"
'FilePath=server.MapPath("Accessories.mdb")
set conn=server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FilePath
v3 = Request.Form.Item("Sno")
v4 = Request.Form.Item("Acc")
v5 = Request.Form.Item("Acnt")
v6 = Request.Form.Item("wc")
v7 = Request.Form.Item("firstn")
v8 = Request.Form.Item("lastn")
v9 = Request.Form.Item("SvcDes")
v10 = Request.Form.Item("stoadd")
v11 = Request.Form.Item("Rmk")
v12 = Request.Form.Item("mnl")
if trim(v3) = "" then v3 = "NA" end if
if trim(v4) = "" then v4 = "NA" end if
if trim(v5) = "" then v5 = "NA" end if
if trim(v6) = "" then v6 = "NA" end if
if trim(v7) = "" then v7 = "NA" end if
if trim(v8) = "" then v8 = "NA" end if
if trim(v9) = "" then v9 = "NA" end if
if trim(v10) = "" then v10 = "NA" end if
if trim(v11) = "" then v11 = "NA" end if
if trim(v12) = "" then v12 = "False" end if
if trim(v12) = "on" then v12 = "True" end if
strValue="update details set [mno]='" & v2 & "', [sno]='" & v3 & "', [acce]='" & v4 _
& "', [ac]='" & v5 & "', [contNo]='" & "NA" & "', [origi]='" & "NA" _
& "', [svcdes]='" & v9 & "', [remark]='" & v11 & "', [dte]='" & date _
& "', [tme]='" & time & "', [mnl]=" & v12 & ", [wc]='" & v6 _
& "', [firstn]='" & v7 & "', [lastn]='" & v8 & "', [stoadd]='" & v10 _
& "' where sono = '" & v1 & "'"
set rs = conn.Execute(strValue)
if Conn.Errors.Count > 0 then
msg="<br>Record Not Added, Invalid Input ........"
else
msg="<br> Record Updated............."
end if
' rs.close
' conn.close
else
msg="<br> No Record(s) were Found............"
end if
else if strvalue="Cle" then
v1=""
v2=""
v3=""
v4=""
v5=""
v6=""
v7=""
v8=""
v9=""
v10=""
v11=""
v12=""
end if
end if
end if
%>
<P align=center><STRONG><U>Accessories Form</U></STRONG></P>
<TABLE align=center border=0>
<TR>
<TD><b><font color="#0000FF">*SO No.</font></b></TD>
<TD><INPUT id=text1 name="Sono" value = "<%=v1%>" size="26">
<INPUT type="button" value="Go" name="go" maxlength="20" OnClick = "click0()"></TD>
</TR>
<TR>
<TD><b><font color="#0000FF">*Model No. </font></b></TD>
<TD><INPUT id=text2 name="Mno" maxlength="20" value = "<%=v2%>" size="31"></TD></TR>
<TR>
<TD><b><font color="#0000FF">Serial No.</font></b></TD>
<TD><INPUT id=text3 name="Sno" maxlength="25" value = "<%=v3%>" size="31"></TD></TR>
<TR>
<TD><b><font color="#0000FF">Accessories Info.</font></b></TD>
<TD><TEXTAREA id=text4 name="Acc" rows="5" cols="26"><%=v4%></TEXTAREA>
<input id=checkbox1 type=checkbox name="mnl" <%if v12="True" then%>Checked<%else%>Unchecked<%end if%>><b><font color="#0000FF">Manual</font></b></TD></TR>
<TR>
<TD><b><font color="#0000FF">Account</font></b></TD>
<TD><INPUT id=text5 name="Acnt" maxlength="250" value = "<%=v5%>" size="31"></TD></TR>
<TR>
<TD><b><font color="#0000FF">Work Centre</font></b></TD>
<TD><INPUT id=text6 name="wc" maxlength="50" value = "<%=v6%>" size="31"></TD></TR>
<TR>
<TD><b><font color="#0000FF">First Name</font></b></TD>
<TD><INPUT id=text7 name="firstn" maxlength="50" value = "<%=v7%>" size="31"></TD></TR>
<TR>
<TD><b><font color="#0000FF">Last Name</font></b></TD>
<TD><INPUT id=text8 name="lastn" maxlength="50" value = "<%=v8%>" size="31"></TD></TR>
<TR>
<TD><b><font color="#0000FF">Service Des.</font></b></TD>
<TD><INPUT id=text9 name="SvcDes" maxlength="50" value = "<%=v9%>" size="31"></TD></TR>
<TR>
<TD><b><font color="#0000FF">Ship To Address</font></b></TD>
<TD><INPUT id=text10 name="stoadd" maxlength="50" value = "<%=v10%>" size="31"></TD></TR>
<TR>
<TD><b><font color="#0000FF">Remarks</font></b></TD>
<TD><TEXTAREA id=remark name="Rmk" rows="5" cols="26"><%=v11%></TEXTAREA></TD></TR>
</TABLE>
<P align=center>
<INPUT type="hidden" name="HidText" align="middle" style="WIDTH: 43px; HEIGHT: 22px" size=5><INPUT type="button" value="Save" name="Save" OnClick = "click1()">
<INPUT type="reset" value="Clear" name="Clear" OnClick = "click3()">
<INPUT type="button" value="Close" name="Close" OnClick = "Click2()">
</P>
</FORM>
<P>
<label><b><font color="#0000FF"><%=msg%></font></b></label> <br> <br> <br>
<font color="#0000FF"><b>*</b></font> - Mandatory Field <br>
</P>
</BODY>
<script language="vbscript">
function click0()
document.etry.HidText.value="PullRecord"
document.etry.submit()
end function
function click1()
document.etry.HidText.value="AdRecord"
document.etry.submit()
end function
function click2()
document.etry.HidText.value="Close"
document.etry.action="MainMenu.asp"
document.etry.submit()
end function
function click3()
document.etry.HidText.value="Cle"
document.etry.submit()
end function
</script>
</html>
Below is my clform.asp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Collection of Equipment Form</title>
<meta name="Microsoft Theme" content="journal 1011, default">
</head>
<body>
<FORM NAME = "clform" ACTION = "clform.asp" METHOD="post" ALIGN="center">
<%
Dim v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,FilePat h,conn,strSql,rs,msg,strValue,Status
on error resume next
v1 = Request.Form.Item("SoNo")
v2 = Request.Form.Item("Mno")
msg=""
strValue=Request.Form.Item("HidText")
if (strvalue="PullRecord") then
if (trim(v1)<>Empty) then
Filepath = "F:\Inetpub\abc\fpdb\Accessories.mdb"
'FilePath=server.MapPath("Accessories.mdb")
set conn=server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FilePath
strsql = "select * from clnform where sono = '" & trim(v1) & "'"
set rs = conn.Execute(strsql)
if not rs.Eof then
v1 = rs(0) & ""
v2 = rs(1) & ""
v3 = rs(2) & ""
v4 = rs(3) & ""
v5 = rs(4) & ""
v6 = rs(5) & ""
v7 = rs(6) & ""
v8 = rs(8) & ""
v9 = rs(7) & ""
v10 = rs(11) & ""
v11 = rs(13) & ""
v12 = rs(14) & ""
v13 = rs(15) & ""
' response.write "V4 = " & v4 & "***" & " V5 = " & v5 & "***" & "V6 = " & v6 & "***" & "V7 =" & v7 & "***" & "V8 = " & v8 & "****" & " V9 =" & v9 & "****" & " V10 =" & v10 & "*****"
else
v2 = ""
msg="<br> No Record were Found............"
' rs.close
' conn.close
end if
else
v2 = ""
msg="<br> Enter SO Number to Search............"
end if
else if (strvalue="AdRecord") then
if (trim(v1)<>Empty and trim(v2)<>Empty) then
Filepath = "F:\Inetpub\abc\fpdb\Accessories.mdb"
'FilePath=server.MapPath("Accessories.mdb")
set conn=server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FilePath
v3 = Request.Form.Item("sno")
v4 = Request.Form.Item("dte")
v5 = Request.Form.Item("cetechid")
v6 = Request.Form.Item("pitechid")
v7 = Request.Form.Item("danames")
v8 = Request.Form.Item("Acc")
v9 = Request.Form.Item("rmk")
v10 = Request.Form.Item("cStatus")
v11 = Request.Form.Item("rStatus")
V12 = Request.Form.Item("ccert")
V13 = Request.Form.Item("mnl")
if trim(v3) = "" then v3 = "NA" end if
if trim(v4) = "" then v4 = "NA" end if
if trim(v5) = "" then v5 = 0 end if
if trim(v6) = "" then v6 = 0 end if
if trim(v7) = "" then v7 = 0 end if
if trim(v8) = "" then v8 = "NA" end if
if trim(v9) = "" then v9 = "NA" end if
if trim(v10) = "" then v10 = 0 end if
if trim(v11) = "" then v11 = 0 end if
if trim(v12) = "" then v12 = "False" end if
if trim(v12) = "on" then v12 = "True" end if
if trim(v13) = "" then v13 = "False" end if
if trim(v13) = "on" then v13 = "True" end if
strsql = "select * from Clnform where sono = '" & trim(v1) & "'"
set rs = conn.Execute(strsql)
if not rs.Eof then
strsql="update Clnform set [mno]='" & v2 & "', [sno]='" & v3 & "', [epdte]='" & v4 & "', [cetechid]='" & v5 _
& "', [pitechid]='" & v6 & "', [daname]='" & v7 & "', [remark]='" & v9 _
& "', [acce]='" & v8 & "', [dte]='" & FormatDateTime(date,2) & "', [tme]='" & FormatDateTime(time,4) _
& "', [cstatus]='" & v10 & "', [rstatus]='" & v11 & "', [mnl]=" & v13 & ", [ccert]=" & v12 & " where sono='" & v1 & "'"
set rs = conn.Execute(strsql)
end if
if Conn.Errors.Count > 0 then
msg="<br>Record Not Updated, Invalid Input ........"
else
msg="<br> Record has been Saved............."
end if
' rs.close
' conn.close
else
msg="<br> Enter SO Number & Press Search button............"
end if
else if strvalue="Cle" then
v1=""
v2=""
v3=""
v4=""
v5=0
v6=0
v7=0
v8=""
v9=""
v10=0
v12=""
v13=""
end if
end if
end if
%>
<P align=center><STRONG><U>Collection of Equipments Form (CALIBRATION/REPAIR)</U></STRONG></P>
<TABLE align=center border=0>
<TR>
<TD><b><font color="#800080">*SO No.</font></b></TD>
<TD><INPUT id=text1 name="Sono" value = "<%=v1%>" size="31">
<INPUT type="button" value="Search" name="go" maxlength="20" OnClick = "click0()">
</TD>
</TR>
<TR>
<TD><b><font color="#800080">Model No.</font></b></TD>
<TD><INPUT id=text2 name="Mno" maxlength="20" value = "<%=v2%>" size="31" readOnly></TD></TR>
<TR>
<TD><b><font color="#800080">Serial No.</font></b> </TD>
<TD><INPUT id=text3 name="sno" maxlength="25" value = "<%=v3%>" size="31" readOnly></TD></TR>
<TR>
<TD><b><font color="#800080">Date</font></b> </TD>
<TD><INPUT id=text4 name="dte" maxlength="50" value = "<%=v4%>" size="36" readOnly></TD></TR>
<TR>
<TD><b><font color="#800080">CE Tech ID</font></b></TD>
<TD><SELECT id=select1 style="width: 225; height: 23" name="CETechID" size="1">
<% if (v5 = 0 or v5 = "") then %><OPTION VALUE = 0 selected>Open</OPTION><%else %><OPTION VALUE = 0>Open</OPTION>
<option value="1169">1169</option>
<option value="1232">1232</option>
<option value="1233">1233</option>
<option value="1234">1234</option>
<option value="1235">1235</option>
<%end if%>
<%
Filepath = "F:\Inetpub\abc\fpdb\Accessories.mdb"
'FilePath=server.MapPath("Accessories.mdb")
set conn=server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FilePath
strsql = "select * from engid"
set rs = conn.Execute(strsql)
While not rs.eof
if v5 = rs("techid") then
response.write("<OPTION value=" & rs("techid") & " selected>" & rs("techid") & "</OPTION>")
else
response.write("<OPTION value=" & rs("techid") & ">" & rs("techid") & "</OPTION>")
end if
rs.moveNext
Wend
rs.close
Set rs=nothing
Conn.close
Set Conn=nothing
%>
</SELECT>
</TD>
</TR>
<TR>
<TD><b><font color="#800080">PI Tech ID</font></b></TD>
<TD><SELECT id=select2 style="width: 151; height: 23" name="PItechID">
<% if v6 = 0 then %><OPTION VALUE = 0 selected>Open</OPTION><%else %><OPTION VALUE = 0>Open</OPTION><%end if%>
<% if v6 = 1 then %><OPTION VALUE = 1 selected>Anuar</OPTION><%else %><OPTION VALUE = 1>Anuar</OPTION><%end if%>
<% if v6 = 2 then %><OPTION VALUE = 2 selected>Misran</OPTION><%else %><OPTION VALUE = 2>Misran</OPTION><%end if%>
<% if v6 = 3 then %><OPTION VALUE = 3 selected>Mush</OPTION><%else %><OPTION VALUE = 3 >Mush</OPTION><%end if%>
</SELECT>
</TD>
</TR>
<TR>
<TD><b><font color="#800080">DA Name</font></b></TD>
<TD><SELECT id=select3 style="width: 151; height: 23" name="DAnames">
<% if v7 = 0 then %><OPTION VALUE = 0 selected>Open</OPTION><%else %><OPTION VALUE = 0>Open</OPTION><%end if%>
<% if v7 = 1 then %><OPTION VALUE = 1 selected>Jessica</OPTION><%else %><OPTION VALUE = 1>Jessica</OPTION><%end if%>
<% if v7 = 2 then %><OPTION VALUE = 2 selected>Jaffar</OPTION><%else %><OPTION VALUE = 2>Jaffar</OPTION><%end if%>
<% if v7 = 3 then %><OPTION VALUE = 3 selected>Catherine</OPTION><%else %><OPTION VALUE = 3>Catherine</OPTION><%end if%>
</SELECT>
</TD>
</TR>
<TR>
<TD><b><font color="#800080">Accessories Info.</font></b></TD>
<TD><TEXTAREA id=text4 name="Acc" rows="5" cols="47" readOnly><%=v8%></TEXTAREA>
<input id=checkbox1 readOnly type=checkbox name="Manual" <%if v13="True" then%>Checked<%else%>Unchecked<%end if%>><b><font color="#0000FF">Manual</font></b>
</TD></TR>
<TR>
<TD><b><font color="#800080">Remarks</font></b></TD>
<TD><TEXTAREA id=remark name="Rmk" rows="5" cols="47"><%=v9%></TEXTAREA></TD></TR>
</TABLE>
<P align=center>
<INPUT type="hidden" name="HidText" align="middle" style="WIDTH: 43px; HEIGHT: 22px" size=5>
<INPUT type="button" value="Save" name="Add" OnClick = "click1()">
<INPUT type="reset" value="Clear" name="Clear" OnClick = "click3()">
<INPUT type="button" value="Close" name="Close" OnClick = "Click2()">
</P>
</FORM>
<P>
<label><b><font color="#0000FF"><%=msg%></font></b></label> <br> <br> <br>
<font color="#0000FF"><b>*</b></font> - Mandatory Field <br>
</P>
</BODY>
<script language="vbscript">
function click0()
document.clform.HidText.value="PullRecord"
document.clform.submit()
end function
function click1()
document.clform.HidText.value="AdRecord"
document.clform.submit()
end function
function click2()
document.clform.HidText.value="Close"
document.clform.action="MainMenu.asp"
document.clform.submit()
end function
function click3()
document.clform.HidText.value="Cle"
document.clform.submit()
end function
</script>
</html>
My clnform
field are sono, mno, sno, epdte, cetechid, pitechid, daname, remark,
ace, dte, tme, cstatus, id, rstatus, ccert, mnl