|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Blank record in Access
I have an ASP form that sends data to an Access database and emails the department that a request has been added. Both work, however in the process of the add to the database it puts in a blank record and the new record everytime. No where in my code is the insert statement more than once. Why would this happen and does anyone have a suggestion as to how to stop it!
Thanks! |
|
#2
|
|||
|
|||
|
post us the code snippet in question.
|
|
#3
|
|||
|
|||
|
Code
It's rather lengthy....
<% DIM rs dim mysql dim dtdate, name, email, treplace, dates, interv, recom, q1, q2, q3, q4, q5, q6, q7, q8, q9, comm, ref1, title1, res1, ref2, title2, res2, ref3, title3, res3 Server.ScriptTimeout = 2147483647 dtdate = Request.Form( "dtdate") name = Request.Form( "name" ) email = Request.Form( "email" ) treplace = Request.Form( "treplace" ) dates = Request.Form( "dates" ) interv = Request.Form( "interv" ) recom = Request.Form( "recom" ) q1 = Request.Form( "q1" ) q2 = Request.Form( "q2" ) q3 = Request.Form( "q3" ) q4 = Request.Form( "q4" ) q5 = Request.Form( "q5" ) q6 = Request.Form( "q6" ) q7 = Request.Form( "q7" ) q8 = Request.Form( "q8" ) q9 = Request.Form( "q9" ) comm = Request.Form( "comm" ) ref1 = Request.Form( "ref1") title1 = Request.Form( "title1" ) res1 = Request.Form( "res1" ) ref2 = Request.Form( "ref2") title2 = Request.Form( "title2" ) res2 = Request.Form( "res2" ) ref3 = Request.Form( "ref3") title3 = Request.Form( "title3" ) res3 = Request.Form( "res3" ) name = Replace(name, "'","''") interv = Replace(interv, "'","''") comm = Replace(comm, "'","''") ref1 = Replace(ref1, "'","''") title1 = Replace(title1, "'","''") res1 = Replace(res1, "'","''") ref2 = Replace(ref2, "'","''") title2 = Replace(title2, "'","''") res2 = Replace(res2, "'","''") ref3 = Replace(ref3, "'","''") title3 = Replace(title3, "'","''") res3 = Replace(res3, "'","''") %> <% Set rs = Server.CreateObject( "ADODB.RecordSet" ) mysql = "Select * from sub_empf where dtdate = '"& dtdate &"' " rs.Open mysql, "DSN=humanresources" if not rs.EOF THEN Response.Write "Duplicate record. Use your back button and reenter your data." rs.Close else rs.Close mysql = "insert into sub_empf (dtdate,name,email,treplace,dates,interv,recom,q1,q2,q3,q4,q5,q6,q7,q8,q9,comm,ref1,title1,res1,ref2 ,title2,res2,ref3,title3,res3) "& "values ('" & date() & "', '" & name & "', '" & email & "', '" & treplace & "', '" & dates & "', '" & interv & "', '" & recom & "', '" & q1 & "', '" & q2 & "', '" & q3 & "', '" & q4 & "', '" & q5 & "', '" & q6 & "', '" & q7 & "', '" & q8 & "', '" & q9 & "', '" & comm & "', '" & ref1 & "', '" & title1 & "', '" & res1 & "', '" & ref2 & "', '" & title2 & "', '" & res2 & "', '" & ref3 & "', '" & title3 & "', '" & res3 & "')" rs.Open mysql, "DSN=humanresources" end if %> <% Dim Mytime, MyDate Mytime= Time() Mydate= Date() Mytimeanddate= Now() %> <!--#include file="sub_emp-mail.asp"--> <HTML> <HEAD> <TITLE>Substitute Staff Employment Form</TITLE> <SCRIPT LANGUAGE="JavaScript"> function printWindow() { bV = parseInt(navigator.appVersion); if (bV >= 4) window.print(); } </script> <script language="JavaScript"> <!-- function formCheck(formobj){ //1) Enter name of mandatory fields var fieldRequired = Array("name"); //2) Enter field description to appear in the dialog box var fieldDescription = Array("Name"); //3) Enter dialog message var alertMsg = "Please complete the following fields:\n"; var l_Msg = alertMsg.length; for (var i = 0; i < fieldRequired.length; i++){ var obj = formobj.elements[fieldRequired[i]]; if (obj){ switch(obj.type){ case "select-one": if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "select-multiple": if (obj.selectedIndex == -1){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "text": case "textarea": if (obj.value == "" || obj.value == null){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; default: if (obj.value == "" || obj.value == null){ alertMsg += " - " + fieldDescription[i] + "\n"; } } } } if (alertMsg.length == l_Msg){ return true; }else{ alert(alertMsg); return false; } } //--> </script> </HEAD> <BODY TEXT="#000000" LINK="#0000ff" VLINK="#551a8b" ALINK="#ff0000" BGCOLOR="#FFFFFF""> <body> <TABLE BORDER="0" width="550"> <form action="sub_emp.asp" method="post" onsubmit="return formCheck(this);"> <input type="hidden" name="dttime" value="dttime"> <tr><th align="center" ><FONT SIZE="+2"><img src="http://testweb/images/logo3.gif" width="40" height="40" alt="" border="0"><STRONG>Kirkwood School District R-7</STRONG></FONT></th></tr> <tr><th align="center"><FONT SIZE="-1"><EM>Excellence in Education Since 1865</EM></FONT></th></tr> <tr><td align="center"><FONT SIZE="2"><STRONG><big>Substitute Staff Employment Form</big></STRONG></FONT></td></tr> <tr><td ><FONT SIZE="-1"><STRONG><CENTER>To be completed, printed, and sent to Human Resources.</STRONG></FONT></td></tr> <tr><td> </td></tr> <tr><td><strong>Name</strong> <input type="text" name="name" size="40" maxlength="40"></td></tr> <tr><td><strong>Email</strong> <input type="text" name="email" size="30" maxlength="30"> </td></tr> <tr><td><strong>If long term, teacher replacing</strong> <input type="text" name="treplace" size="42" maxlength="50"></td></tr> <tr><td><strong>Dates of anticipated long term assignment </strong><input type="text" name="dates" size="10" maxlength="10"><strong> Yrs</strong></td></tr> <tr><td><strong>Name(s) of Interviewer(s)</strong> <input type="text" name="interv" size="54" maxlength="54"></td></tr> </TR> <tr><td><strong>Recommendation for hire: <input type="checkbox" name="recom" value="yes">yes <input type="checkbox" name="recom" value="no">no <td></tr> </table> <br> <b><big>Rating Categories Referring to the Job Description for this position:</big></b> <br> <table border="0" cellpadding="3" cellspacing="3" width="550"> <tr><td>Ability to effectively deal with discipline problems.</td> <td><input type="checkbox" name="q1" value="Outstanding">Outstanding <input type="checkbox" name="q1" value="Good">Good <input type="checkbox" name="q1" value="Fair">Fair </td></tr> <tr><td>Ability to avoid discipline problems.</td> <td><input type="checkbox" name="q2" value="Outstanding">Outstanding <input type="checkbox" name="q2" value="Good">Good <input type="checkbox" name="q2" value="Fair">Fair </td></tr> <tr><td>Ability to communicate effectively.</td> <td><input type="checkbox" name="q3" value="Outstanding">Outstanding <input type="checkbox" name="q3" value="Good">Good <input type="checkbox" name="q3" value="Fair">Fair </td></tr> <tr><td>Ability to follow written and oral instructions.</td> <td><input type="checkbox" name="q4" value="Outstanding">Outstanding <input type="checkbox" name="q4" value="Good">Good <input type="checkbox" name="q4" value="Fair">Fair </td></tr> <tr><td>Ability to organize instructional time.</td> <td><input type="checkbox" name="q5" value="Outstanding">Outstanding <input type="checkbox" name="q5" value="Good">Good <input type="checkbox" name="q5" value="Fair">Fair </td></tr> <tr><td>Ability to keep students on task.</td> <td><input type="checkbox" name="q6" value="Outstanding">Outstanding <input type="checkbox" name="q6" value="Good">Good <input type="checkbox" name="q6" value="Fair">Fair </td></tr> <tr><td>Ability to work with students effectively.</td> <td><input type="checkbox" name="q7" value="Outstanding">Outstanding <input type="checkbox" name="q7" value="Good">Good <input type="checkbox" name="q7" value="Fair">Fair </td></tr> <tr><td>Ability to establish and maintain effective relationships with students, staff, and community.</td> <td><input type="checkbox" name="q8" value="Outstanding">Outstanding <input type="checkbox" name="q8" value="Good">Good <input type="checkbox" name="q8" value="Fair">Fair </td></tr> <tr><td>Ability to perform the essential job functions.</td> <td><input type="checkbox" name="q9" value="Outstanding">Outstanding <input type="checkbox" name="q9" value="Good">Good <input type="checkbox" name="q9" value="Fair">Fair </td></tr> </table> <TABLE BORDER=0 width="650"> <tr><td><strong>Comments/Special Instructions</strong></td></tr> <tr><td><textarea cols="64" rows="5" name="comm"></textarea></td></tr> <TABLE BORDER=0 width="650"> <b><big>Three references are required for new employees.</big></b> <tr><td></td></tr> <tr><td><strong>Name</strong> <input type="text" name="ref1" size="29" maxlength="29"> <strong>Position/Title</strong> <input type="text" name="title1" size="27" maxlength="27"></td></tr> <tr><td><b>Response:</b><br><textarea cols="64" rows="2" name="res1"></textarea></td></tr> <tr><td><strong>Name</strong> <input type="text" name="ref2" size="29" maxlength="29"> <strong>Position/Title</strong> <input type="text" name="title2" size="27" maxlength="27"></td></tr> <tr><td><b>Response:</b><br><textarea cols="64" rows="2" name="res2"></textarea></td></tr> <tr><td><strong>Name</strong> <input type="text" name="ref3" size="29" maxlength="29"> <strong>Position/Title</strong> <input type="text" name="title3" size="27" maxlength="27"></td></tr> <tr><td><b>Response:</b><br><textarea cols="64" rows="2" name="res3"></textarea></td></tr> </table> <table width="650"><tr><td><br> <b>PLEASE SEND ANY ADDITIONAL APPLICATION MATERIALS THROUGH INTEROFFICE MAIL</td></tr> <tr><td colspan="2">To <b>Print</b> Applicaton Please Go to <b>File - Print</b> from your menu bar.<INPUT TYPE="hidden" NAME="To" value="youngan@gw.kirkwood.k12.mo.us"></td></tr> <tr><td colspan="2"><B>By pressing the Submit button you are agreeing to a binding signature and submitting the form to Roxie Hufford in Human Resources.</B></td></tr> <tr><td colspan="0"><br><input type="submit" name="send" value="Submit" width="3" height="1"><p></td></tr> </table> </BODY> </HTML> |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Blank record in Access |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|