Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

All fields not saved

Status
Not open for further replies.

skw8966

Programmer
Apr 12, 2001
59
US
I have several active server pages to input and display data from my MS Access database.

The view pages display the database information perfectly.

The input pages only save certain fields.

My first three fields are saved to the database and last three aren't.

I can send the code from my input page if that helps.

Can anyone tell me the problem with these last three fields?

Thanks,
 
[tt]No need to send it anywhere. Post your code here.
 
<%
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader &quot;pragma&quot;, &quot;no-cache&quot;
Response.addHeader &quot;cache-control&quot;, &quot;private&quot;
Response.CacheControl = &quot;no-cache&quot;
%>
<!--#include file=&quot;db.asp&quot;-->
<!--#include file=&quot;aspmkrfn.asp&quot;-->
<%
Response.Buffer = True
'get action
a = Request.Form(&quot;a&quot;)
If (a = &quot;&quot; OR IsNull(a)) Then
key = Request.Querystring(&quot;key&quot;)
If key <> &quot;&quot; Then
a = &quot;C&quot; 'copy record
Else
a = &quot;I&quot; 'display blank record
End If
End If
' Open Connection to the database
Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open xDb_Conn_Str
Select Case a
Case &quot;C&quot;: ' Get a record to display
tkey = &quot;&quot; & key & &quot;&quot;
strsql = &quot;SELECT * FROM [tblCallbackDetail] WHERE [pkAuto]=&quot; & tkey
Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rs.Open strsql, conn
If rs.EOF Then
Response.Clear
Response.Redirect &quot;tblCallbackDetaillist.asp&quot;
Else
rs.MoveFirst
' Get the field contents
x_fkAuto = rs(&quot;fkAuto&quot;)
x_AcctNo = rs(&quot;AcctNo&quot;)
x_FromArea = rs(&quot;FromArea&quot;)
x_Reason = rs(&quot;Reason&quot;)
x_ToArea=rs(&quot;ToArea&quot;)
End If
rs.Close
Set rs = Nothing
Case &quot;A&quot;: ' Add
'get fields from form
x_pkAuto = Request.Form(&quot;x_pkAuto&quot;)
x_fkAuto = Request.Form(&quot;x_fkAuto&quot;)
x_AcctNo = Request.Form(&quot;x_AcctNo&quot;)
x_FromArea = Request.Form(&quot;x_FromArea&quot;)
x_Reason = Request.Form(&quot;x_Reason&quot;)
x_ToArea = Request.Form(&quot;x_ToArea&quot;)
' Open record
strsql = &quot;SELECT * FROM [tblCallbackDetail] WHERE 0 = 1&quot;
Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rs.Open strsql, conn, 1, 2
rs.AddNew
tmpFld = x_fkAuto
If Not IsNumeric(tmpFld) Then tmpFld = 0
rs(&quot;fkAuto&quot;) = cLng(tmpFld)
tmpFld = Trim(x_AcctNo)
If trim(tmpFld) & &quot;x&quot; = &quot;x&quot; Then tmpFld = Null
rs(&quot;AcctNo&quot;) = tmpFld
tmpFld = Trim(x_FromArea)
If trim(tmpFld) & &quot;x&quot; = &quot;x&quot; Then tmpFld = Null
rs(&quot;FromArea&quot;) = tmpFld
tmpFld = Trim(x_Reason)
If trim(tmpFld) & &quot;x&quot; = &quot;x&quot; Then tmpFld = Null
rs(&quot;Reason&quot;) = tmpFld
tmpFld = Trim(x_ToArea)
If trim(tmpFld) & &quot;x&quot; = &quot;x&quot; Then tmpFld = Null
rs(&quot;ToArea&quot;) = tmpFld
rs.Update
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
Response.Clear
Response.Redirect &quot;tblCallbackDetaillist.asp&quot;
End Select
%>
<!--#include file=&quot;header.asp&quot;-->
<p><font face=&quot;Book Antiqua&quot; size=&quot;2&quot;>Add Callback Detail<br>
<br><a href=&quot;tblCallbackDetaillist.asp&quot;>Back to List</font></a></p>
<script language=&quot;JavaScript&quot; src=&quot;ew.js&quot;></script>
<script language=&quot;JavaScript&quot;>
<!-- start Javascript
function EW_checkMyForm(EW_this) {
if (EW_this.x_fkAuto && !EW_checkinteger(EW_this.x_fkAuto.value)) {
if (!EW_onError(EW_this, EW_this.x_fkAuto, &quot;TEXT&quot;, &quot;Incorrect integer - fk Auto&quot;))
return false;
}
return true;
}
// end JavaScript -->
</script>
<form onSubmit=&quot;return EW_checkMyForm(this);&quot; action=&quot;tblCallbackDetailadd.asp&quot; method=&quot;post&quot;>
<p>
<input type=&quot;hidden&quot; name=&quot;a&quot; value=&quot;A&quot;>
<table border=&quot;0&quot; cellspacing=&quot;1&quot; cellpadding=&quot;5&quot; bgcolor=&quot;#CCCCCC&quot;>
<tr>
<td bgcolor=&quot;#0099CC&quot;><font color=&quot;#FFFFFF&quot;><font face=&quot;Book Antiqua&quot; size=&quot;2&quot;>pk
Auto</font> </font></td>
<td bgcolor=&quot;#CCFFFF&quot;><font face=&quot;Book Antiqua&quot; size=&quot;2&quot;><%= x_pkAuto %>
<input type=&quot;hidden&quot; name=&quot;x_pkAuto&quot; value=&quot;<%= x_pkAuto %>&quot;>
</font> </td>
</tr>
<tr>
<td bgcolor=&quot;#0099CC&quot;><font color=&quot;#FFFFFF&quot;><font face=&quot;Book Antiqua&quot; size=&quot;2&quot;>fk
Auto</font></font></td>
<td bgcolor=&quot;#CCFFFF&quot;><font face=&quot;Book Antiqua&quot; size=&quot;2&quot;>
<% If Session(&quot;tblCallbackDetail_masterkey&quot;) <> &quot;&quot; Then
x_fkAuto = Session(&quot;tblCallbackDetail_masterkey&quot;) %>
<% response.write x_fkAuto %>
<input type=&quot;hidden&quot; name=&quot;x_fkAuto&quot; value=&quot;<%= x_fkAuto %>&quot;>
<% Else %>
<input type=&quot;text&quot; name=&quot;x_fkAuto&quot; value=&quot;<%= Server.HtmlEncode(x_fkAuto&&quot;&quot;) %>&quot;>
<% End If %>
</font> </td>
</tr>
<tr>
<td bgcolor=&quot;#0099CC&quot;><font color=&quot;#FFFFFF&quot;><font face=&quot;Book Antiqua&quot; size=&quot;2&quot;>Acct
No</font> </font></td>
<td bgcolor=&quot;#CCFFFF&quot;><font face=&quot;Book Antiqua&quot; size=&quot;2&quot;>
<input type=&quot;text&quot; name=&quot;x_AcctNo&quot; size=30 maxlength=50 value=&quot;<%= Server.HtmlEncode(x_AcctNo&&quot;&quot;) %>&quot;>
</font></td>
</tr>
<tr>
<td bgcolor=&quot;#0099CC&quot;><font color=&quot;#FFFFFF&quot;>From:</font></td>
<td bgcolor=&quot;#CCFFFF&quot;><font face=&quot;Book Antiqua&quot; size=&quot;2&quot;>
<% If isnull(x_FromArea) or x_FromArea = &quot;&quot; Then x_FromArea = 0 'set default value %>
<input type=&quot;text&quot; name=&quot;x_FromArea&quot; value=&quot;<%= Server.HtmlEncode(x_FromArea&&quot;&quot;) %>&quot;>
</font></td>
</tr>
<tr>
<td bgcolor=&quot;#0099CC&quot;><font color=&quot;#FFFFFF&quot;>Reason</font></td>
<td bgcolor=&quot;#CCFFFF&quot;><font face=&quot;Book Antiqua&quot; size=&quot;2&quot;>
<% If isnull(x_Reason) or x_Reason = &quot;&quot; Then x_Reason = 0 'set default value %>
</font>
<input name=&quot;textfield&quot; type=&quot;text&quot; value=&quot;<%= Server.HtmlEncode(x_Reason&&quot;&quot;) %>&quot;></td>
</tr>
<tr>
<td bgcolor=&quot;#0099CC&quot;><font color=&quot;#FFFFFF&quot;>To: </font></td>
<td bgcolor=&quot;#CCFFFF&quot;><font face=&quot;Book Antiqua&quot; size=&quot;2&quot;>
<% If isnull(x_ToArea) or x_ToArea = &quot;&quot; Then x_ToArea = 0 'set default value %>
</font>
<input name=&quot;textfield2&quot; type=&quot;text&quot; value=&quot;<%= Server.HtmlEncode(x_ToArea&&quot;&quot;) %>&quot;></td>
</tr>
</table>
<p>
<input type=&quot;submit&quot; name=&quot;Action&quot; value=&quot;ADD&quot;>
</form>
<!--#include file=&quot;footer.asp&quot;-->
 
Well, it looks like everything should be working but the values for x_Reason and x_ToArea.

Compare the section in Case A where you assign the variables fro the form to the names you have used in the form and you should see the inconsistencies.
Code:
-section from Add section
x_pkAuto = Request.Form(&quot;x_pkAuto&quot;)
x_fkAuto = Request.Form(&quot;x_fkAuto&quot;)
x_AcctNo = Request.Form(&quot;x_AcctNo&quot;)
x_FromArea = Request.Form(&quot;x_FromArea&quot;)
x_Reason = Request.Form(&quot;x_Reason&quot;)
x_ToArea = Request.Form(&quot;x_ToArea&quot;)

-form without extraneous tags
<form onSubmit=&quot;return EW_checkMyForm(this);&quot;  action=&quot;tblCallbackDetailadd.asp&quot; method=&quot;post&quot;>
<input type=&quot;hidden&quot; name=&quot;x_pkAuto&quot; value=&quot;<%= x_pkAuto %>&quot;>
<input type=&quot;hidden&quot; name=&quot;x_fkAuto&quot; value=&quot;<%= x_fkAuto %>&quot;>
<input type=&quot;text&quot; name=&quot;x_AcctNo&quot; size=30 maxlength=50 value=&quot;<%= Server.HtmlEncode(x_AcctNo&&quot;&quot;) %>&quot;>
<input type=&quot;text&quot; name=&quot;x_FromArea&quot; value=&quot;<%= Server.HtmlEncode(x_FromArea&&quot;&quot;) %>&quot;>
<input name=&quot;textfield&quot; type=&quot;text&quot; value=&quot;<%= Server.HtmlEncode(x_Reason&&quot;&quot;) %>&quot;></td>
<input name=&quot;textfield2&quot; type=&quot;text&quot; value=&quot;<%= Server.HtmlEncode(x_ToArea&&quot;&quot;) %>&quot;></td>
<input type=&quot;submit&quot; name=&quot;Action&quot; value=&quot;ADD&quot;>
</form>

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top