Advertisement

05.19.2008 at 06:38AM PDT, ID: 23413654
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.4

How would a field "clear" in an Access database  after submitting a form using .asp on our intranet?

Asked by mschmidt14 in Active Server Pages (ASP), VB Script

Tags:

I am using a form on our intranet to update an Access database.  Somehow the update is clearing one of the fields in the database.  

This is someone's else code but it just looks like your basic html, vbscript and asp.  I am a beginner at this and have stared at this for days and I need another pair of eyes because I can't figure it out.

The field that is clearing is "tocsi".  I am attaching the code.  If you need anything else, please let me know.
Thanks,
KellyStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/JXECM.asp" -->
 
 
<%
' *** Edit Operations: declare variables
 
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
 
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
 
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
 
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Request.QueryString
End If
 
' boolean to abort record edit
MM_abortEdit = false
 
' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables
 
If (CStr(Request("MM_update")) = "csiresponse" And CStr(Request("MM_recordId")) <> "") Then
 
  MM_editConnection = MM_JXECM_STRING
  MM_editTable = "tblCSI"
  MM_editColumn = "CSIID"
  MM_recordId = "" + Request.Form("MM_recordId") + ""
  MM_editRedirectUrl = "viewresponse_kelly.asp"
  MM_fieldsStr  = "respondent|value|response|value|responddate|value|tocsi|value|followup|value|complete|value"
  MM_columnsStr = "Respondent|',none,''|Response|',none,''|RespondDate|',none,NULL|Tocsi|',none,''|Followup|',none,''|Complete|none,1,0"
 
  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
  
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
   'response.Write "<BR>Setting field" & MM_fields(MM_i+1)& "to" & CStr(Request.Form(MM_fields(MM_i))) & "<BR>" 
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next
 
  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If
 
End If
%>
<%
' *** Update Record: construct a sql update statement and execute it
 
If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then
 
  ' create the sql update statement
  MM_editQuery = "update " & MM_editTable & " set "
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    
    If UBound(MM_typeArray)>= 2 Then
       MM_emptyVal = MM_typeArray(2)
    Else
       MM_emptyVal = ""
    End If
    
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
      MM_formVal = MM_emptyVal
    Else
      If (MM_altVal <> "") Then
        MM_formVal = MM_altVal
      ElseIf (MM_delim = "'") Then  ' escape quotes
        MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
      Else
        MM_formVal = MM_delim + MM_formVal + MM_delim
      End If
    End If
      
    If (MM_i <> LBound(MM_fields)) Then
      MM_editQuery = MM_editQuery & ","
    End If
    MM_editQuery = MM_editQuery & MM_editTable & "." & MM_columns(MM_i) & " = " & MM_formVal   
    
  Next
  MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId
 
  If (Not MM_abortEdit) Then
    ' execute the update
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    Response.write MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
 
    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If
 
End If
%>
 
 
<html>
<head>
<title>CSI Response Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
 
<body>
 
<%
Dim rsEmp__MMColParam
rsEmp__MMColParam = "1"
If (Request.QueryString("CSIID") <> "") Then 
  rsEmp__MMColParam = Request.QueryString("CSIID")
End If
%>
 
<%
Dim rsEmp
Dim rsEmp_numRows
 
Set rsEmp = Server.CreateObject("ADODB.Recordset")
rsEmp.ActiveConnection = MM_JXECM_STRING
rsEmp.Source = "SELECT EmployeeName FROM Employee ORDER BY EmployeeName ASC"
rsEmp.CursorType = 0
rsEmp.CursorLocation = 2
rsEmp.LockType = 1
rsEmp.Open()
 
rsEmp_numRows = 0
%>
 
 
<%
Dim rsCSIresponse__MMColParam
rsCSIresponse__MMColParam = "1"
If (Request.QueryString("CSIID") <> "") Then 
  rsCSIresponse__MMColParam = Request.QueryString("CSIID")
End If
%>
 
<%
Dim rsCSIresponse
Dim rsCSIresponse_numRows
 
Set rsCSIresponse = Server.CreateObject("ADODB.Recordset")
rsCSIresponse.ActiveConnection = MM_JXECM_STRING
rsCSIresponse.Source = "SELECT * FROM tblCSI WHERE CSIID = " + Replace(rsCSIresponse__MMColParam, "'", "''") + ""
rsCSIresponse.CursorType = 0
rsCSIresponse.CursorLocation = 2
rsCSIresponse.LockType = 1
rsCSIresponse.Open()
 
rsCSIresponse_numRows = 0
%>
<!--#include file="header.inc"-->
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="csiresponse" id="csiresponse">
  
  <table width="510" border="1" align="center" height="400">
    <tr bgcolor="#0099FF">
      <td colspan="6" height="19" width="500">
        <div align="center"><strong>CSI Response and Follow-Up Form</strong></div></td>
    </tr>
    <tr> 
      <td width="415" nowrap height="33"><strong>To</strong>: <%=(rsCSIresponse.Fields.Item("Tocsi").Value)%> </td>
      <td colspan="4" rowspan="3" height="83" width="2"> </td>
      <td width="71" nowrap height="33"><strong>Issue Date</strong>: <%=(rsCSIresponse.Fields.Item("IssueDate").Value)%></td>
    </tr>
    
    
   <tr><td width="415" valign="top" nowrap><strong>Respondent</strong>
        <select name="respondent" size="1" id="respondent">
     <%
While (NOT rsEmp.EOF)
%>
       <option value="<%=(rsEmp.Fields.Item("EmployeeName").Value)%>"><%=(rsEmp.Fields.Item("EmployeeName").Value)%></option>
       <%
  rsEmp.MoveNext()
Wend
If (rsEmp.CursorType > 0) Then
  rsEmp.MoveFirst
Else
  rsEmp.Requery
End If
%>
      </select>
        </div></td>
 
 
 
       <td width="71"><strong>Response Date</strong>: <%=(rsCSIresponse.Fields.Item("RespondDate").Value)%><input name="responddate" type="text" id="responddate">
        <font color="#FF0000"><strong>(xx/xx/xx)</strong></font></td>
   </tr>
    <tr> 
      <td nowrap height="19" width="415"><strong>Origin:</strong> <%=(rsCSIresponse.Fields.Item("Origin").Value)%></td>
      <td height="19" width="71"><strong>CSI Code:</strong> <%=(rsCSIresponse.Fields.Item("CSICODE").Value)%></td>
    </tr>
    
 
    <tr> 
      <td colspan="6" height="19" width="500"><strong>Customer Info:</strong> <%=(rsCSIresponse.Fields.Item("CustomerInformation").Value)%></td>
    </tr>
    <tr> 
      <td colspan="6" height="19" width="500"><strong>Issue:</strong> <%=(rsCSIresponse.Fields.Item("Issue").Value)%></td>
    </tr>
    <tr valign="top"> 
      <td colspan="6" height="174" width="500"><strong>Response</strong>: 
      <textarea name="response" cols="60" rows="7" id="response"><%=(rsCSIresponse.Fields.Item("Response").Value)%></textarea></td>
    </tr>
   <tr>
    <td colspan="6"><strong>Follow-Up</strong>: 
        <textarea name="followup" cols="60" id="textarea" rows="1"></textarea></td>
    </tr>
     
    <tr> 
      <td colspan="6"><strong>Complete: 
        <input name="complete" type="checkbox" id="complete" value="checkbox" checked>
        <font color="#FF0000">If checked, the issue will close!</font></strong></td>
    </tr>
  
    <tr> 
      <td colspan="6" height="25" width="500"> <input type="submit" name="Submit" value="Submit"></td>
    </tr>
  </table>
  
<input type="hidden" name="MM_update" value="csiresponse">
  <input type="hidden" name="MM_recordId" value="<%= rsCSIresponse.Fields.Item("CSIID").Value %>">
</form>
 
</body>
</html>
<%
rsCSIresponse.Close()
Set rsCSIresponse = Nothing
%>
 
<%
rsEmp.Close()
Set rsEmp = Nothing
%>
[+][-]05.19.2008 at 07:42AM PDT, ID: 21598202

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 07:49AM PDT, ID: 21598279

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 08:26AM PDT, ID: 21598601

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Active Server Pages (ASP), VB Script
Tags: .asp, vbscript
Sign Up Now!
Solution Provided By: nkoriginal
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.19.2008 at 08:29AM PDT, ID: 21598643

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 08:41AM PDT, ID: 21598756

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 08:42AM PDT, ID: 21598761

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628