PDA

View Full Version : Relatively new and have a Insert Into statement problem



keltra
02-04-2005, 03:23 PM
I have created a form that will put all info into MS Access database. All my other forms are working fine. The form page is here - http://www.pse.org/pse-alumni-survey.asp. When I fill in the form and submit I get this error - Microsoft JET Database Engine error '80040e14'
Syntax error in INSERT INTO statement.
/pse-alumni-survey-process.asp, line 57
Here is the code from the process page





<%'// Load Data from From, write to Database

FName = SQLCleaner(Request.Form("FName"))
LName = SQLCleaner(Request.Form("LName"))
Chapter = SQLCleaner(Request.Form("Chapter"))
Spouse = SQLCleaner(Request.Form("Spouse"))
SYes = SQLCleaner(Request.Form("SYes"))
SAlum = SQLCleaner(Request.Form("SAlum"))
SGrad = SQLCleaner(Request.Form("SGrad"))
Children = SQLCleaner(Request.Form("Children"))
CMany = SQLCleaner(Request.Form("CMany"))
CYes = SQLCleaner(Request.Form("CYes"))
CChap = SQLCleaner(Request.Form("CChap"))
Judge = SQLCleaner(Request.Form("Judge"))
Mentor = SQLCleaner(Request.Form("Mentor"))
Shad = SQLCleaner(Request.Form("Shad"))
Job = SQLCleaner(Request.Form("Job"))
Cert = SQLCleaner(Request.Form("Cert"))
Gath = SQLCleaner(Request.Form("Gath"))
Rec = SQLCleaner(Request.Form("Rec"))
Spons = SQLCleaner(Request.Form("Spons"))
Smei = SQLCleaner(Request.Form("Smei"))
Board = SQLCleaner(Request.Form("Board"))
Nef = SQLCleaner(Request.Form("Nef"))
Naa = SQLCleaner(Request.Form("Naa"))
Conv = SQLCleaner(Request.Form("Conv"))
Local = SQLCleaner(Request.Form("Local"))
Writ = SQLCleaner(Request.Form("Writ"))
Proj = SQLCleaner(Request.Form("Proj"))
Disc = SQLCleaner(Request.Form("Disc"))
Natl = SQLCleaner(Request.Form("Natl"))
Other = SQLCleaner(Request.Form("Other"))
Indust = SQLCleaner(Request.Form("Indust"))
Company = SQLCleaner(Request.Form("Company"))
Title = SQLCleaner(Request.Form("Title"))
Years = SQLCleaner(Request.Form("Years"))
Contact = SQLCleaner(Request.Form("Contact"))
Info = SQLCleaner(Request.Form("Info"))
YName = SQLCleaner(Request.Form("YName"))
Address = SQLCleaner(Request.Form("Address"))
City = SQLCleaner(Request.Form("City"))
YState = SQLCleaner(Request.Form("YState"))
Zip = SQLCleaner(Request.Form("Zip"))
HPhone = SQLCleaner(Request.Form("HPhone"))
WPhone = SQLCleaner(Request.Form("WPhone"))
Fax = SQLCleaner(Request.Form("Fax"))
Email = SQLCleaner(Request.Form("Email"))
Prefer = SQLCleaner(Request.Form("Prefer"))
DateEntered = Date

SQLString = "Insert INTO Alum (FName, LName, Chapter, Spouse, SYes, SAlum, SGrad, Children, CMany, CYes, CChap, Judge, Mentor, Shad, Job, Cert, Gath, Rec, Spons, Smei, Board, Nef, Naa, Conv, Local, Writ, Proj, Disc, Natl, Other, Indust, Company, Title, Years, Contact, Info, YName, Address, City, YState, Zip, HPhone, WPhone, Fax, Email, Prefer, Date) VALUES ('" & FName & "', '" & LName & "', '" & Chapter & "', '" & Spouse & "', '" & SYes & "', '" & SAlum & "', '" & SGrad & "', '" & Children & "', '" & CMany & "', '" & CYes & "', '" & CChap & "', '" & Judge & "', '" & Mentor & "', '" & Shad & "', '" & Job & "', '" & Cert & "', '" & Gath & "', '" & Rec & "', '" & Spons & "', '" & Smei & "', '" & Board & "', '" & Nef & "', '" & Naa & "', '" & Conv & "', '" & Local & "', '" & Writ & "', '" & Proj & "', '" & Disc & "', '" & Natl & "', '" & Other & "', '" & Indust & "', '" & Company & "', '" & Title & "', '" & Years & "', '" & Contact & "', '" & Info & "', '" & YName & "', '" & Address & "', '" & City & "', '" & YState & "', '" & Zip & "', '" & HPhone & "', '" & WPhone & "', '" & Fax & "', '" & Email & "', '" & Prefer & "', '"& Date &"'); "

DbChapObj.Execute(SQLString)
%>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF">



<%MenuSet="PSE"%>


<%MenuSet="ALUMNI"%>



<table width="760" border="0" cellspacing="10" cellpadding="7">
<tr>
<td colspan=3 valign="top">images/elements/white.gifImages/titles/alumsurvey.gif</td>
</tr>

<td valign="top">
<p align="center" class="bodytext">
</td>
<td width="491" valign="top">
<p align="left" class="bodytext">We
thank you for filling out this survey. Your responses will provide
us with valuable information as we create various programs to help
you continue your professional growth. If you have any comments
or suggestions, please let us know: pse@pse.org (pse@pse.org?Subject=Alumni Survey&CC=&BCC=&Body=)</p>
</td>
<td width="8" valign="top"></td>
</tr>
</table>


</td>
</tr>
</table>

</html>


Line 57 is DbChapObj.Execute(SQLString). The error is supposed to be that one of the columns is a reserv ed word. I have tried everything and am stumped now. Can anyone help?

compusolver
02-07-2005, 07:03 PM
Didn't take time to look at this very carefully, but your last field name appears to be 'Date' - a reserved word.

keltra
02-07-2005, 08:35 PM
I tried to change that to "DateEntered". That doesn't work either.

Tracy

caromero1965
02-12-2005, 02:26 AM
In some dialects of SQL there's a CONV function. Found a reference to it here:

http://www.oreilly.com/catalog/sqlnut/chapter/ch04.html

Not sure if this applies to MS databases.