I want to update 1 field in a record on the website-here is the code-but it's not doing a/t. I'm fairly new to this so I'd appreciate help. (do I have to list all fields-even though I'm just working with one?)
heres the code:
Select Case a
Case "I": ' Get a record to display
tkey=key
strsql = "SELECT * FROM [sessions] WHERE [recNum]=" & tkey
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn
If rs.EOF Then
Response.Clear
Response.Redirect "results.asp?ReportType=SR"
Else
rs.MoveFirst
End If
' Get the field contents
x_SessionNote = rs("SpecifyAmountOfProgressOrLackOfProgress")
rs.Close
Set rs = Nothing
Case "U": ' Update
' Open record
tkey=key
strsql = "SELECT * FROM [Sessions] WHERE [recNum]=" & tkey
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 2
If rs.EOF Then
Response.Clear
Response.Redirect "results.asp?ReportType=SR"
End If
tmpFld = x_SessionNote
rs("SpecifyAmountOfProgressOrLackOfProgress") = tmpFld
rs.Update
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
Response.Clear
Response.Redirect "results.asp?ReportType=SR"
End Select
%>
<!--#include file="header.asp"-->
<form action="SessionNoteEdit.asp" method="post">
<table border="0" cellspacing="1" cellpadding="5" bgcolor="#CCCCCC" width="569">
<input type="hidden" name="x_SessionNote" value="<%= x_SessionNote %>">
<input type="hidden" name="key" value="<%= key %>">
<input type="hidden" name="a" value="U">
<tr>
<td bgcolor="#9966ff" width="74"> </td>
<td bgcolor="#F5F5F5" width="472">
<p align="center"><b><font face="Arial" size="4">Use this page to edit Session
Note. </font></b></p>
<p><font face="Arial">When finished editing click on the save button to
save the Session note, or Click the cancel to disregard the Changes and return to the
Session notes page</font></td>
</tr>
<tr>
<td bgcolor="#9966ff" width="74"><font color="#FFFFFF">Session Note </font></td>
<td bgcolor="#F5F5F5" width="472"><font size="-1">
<textarea name="x_SessionNote" cols="50" rows="3"><%= x_SessionNote %></textarea>
</tr>
</table>
<p>
<input type="button" value="Cancel" onclick="history.go(-1);">
<input type="submit" name="Action" value="SAVE"></form>
heres the code:
Select Case a
Case "I": ' Get a record to display
tkey=key
strsql = "SELECT * FROM [sessions] WHERE [recNum]=" & tkey
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn
If rs.EOF Then
Response.Clear
Response.Redirect "results.asp?ReportType=SR"
Else
rs.MoveFirst
End If
' Get the field contents
x_SessionNote = rs("SpecifyAmountOfProgressOrLackOfProgress")
rs.Close
Set rs = Nothing
Case "U": ' Update
' Open record
tkey=key
strsql = "SELECT * FROM [Sessions] WHERE [recNum]=" & tkey
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 2
If rs.EOF Then
Response.Clear
Response.Redirect "results.asp?ReportType=SR"
End If
tmpFld = x_SessionNote
rs("SpecifyAmountOfProgressOrLackOfProgress") = tmpFld
rs.Update
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
Response.Clear
Response.Redirect "results.asp?ReportType=SR"
End Select
%>
<!--#include file="header.asp"-->
<form action="SessionNoteEdit.asp" method="post">
<table border="0" cellspacing="1" cellpadding="5" bgcolor="#CCCCCC" width="569">
<input type="hidden" name="x_SessionNote" value="<%= x_SessionNote %>">
<input type="hidden" name="key" value="<%= key %>">
<input type="hidden" name="a" value="U">
<tr>
<td bgcolor="#9966ff" width="74"> </td>
<td bgcolor="#F5F5F5" width="472">
<p align="center"><b><font face="Arial" size="4">Use this page to edit Session
Note. </font></b></p>
<p><font face="Arial">When finished editing click on the save button to
save the Session note, or Click the cancel to disregard the Changes and return to the
Session notes page</font></td>
</tr>
<tr>
<td bgcolor="#9966ff" width="74"><font color="#FFFFFF">Session Note </font></td>
<td bgcolor="#F5F5F5" width="472"><font size="-1">
<textarea name="x_SessionNote" cols="50" rows="3"><%= x_SessionNote %></textarea>
</tr>
</table>
<p>
<input type="button" value="Cancel" onclick="history.go(-1);">
<input type="submit" name="Action" value="SAVE"></form>