I'm trying to post data from a form to a table using the cfinsert/cfupdate commands. While I realize Macromedia doesn't recommend the functions anymore, I haven't had any problems until now. The only error message I receive is "[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement." I've reviewed the formfields, ensured they match the form, etc.. I'm not stumped, especially since this code executes correctly on other pages? Are any of these fields reserved fields that should be avoided??
Here's page 1 <Form Page>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
<link rel="stylesheet" href="default.css" type="text/css">
</head>
<cfquery name="qryDates" datasource="labor" dbtype="ODBC">
SELECT Date
FROM tbl_LD_Dates
ORDER BY sorter
</cfquery>
<cfquery name="qryUser" datasource="labor" dbtype="ODBC">
SELECT EmpNum, EmpName
FROM tbl_LD_Employees
WHERE (EmpNum = '#session.logonid#')
</cfquery>
<cfquery name="qryActivity" datasource="labor" dbtype="ODBC">
select subactivity, name from tbl_ld_subactivity order by subactivity;
</cfquery>
<cfquery name="qryTime" datasource="labor" dbtype="ODBC">
select time from tbl_ld_time
</cfquery>
<CFSET todayDate = Now()>
<cfset varNow = #dateformat(todayDate, "m/d/yyyy")#>
<body text="#FFFFFF"><cfform name="Survey" method="post" action="LD_Action.cfm">
<div align="center"><b><span class="title">Reserve Accounts & Loans - Labor Survey</span></b>
</div>
<hr>
<div align="center"><span class="title"><b><cfoutput>#qryuser.empname#</cfoutput></b> (<a href=../login/login.cfm>Not You?</a>)</span></div>
<hr>
<cfset varUser="#session.logonid#">
<div id="Layer1" style="position:absolute; width:633px; height:98px; z-index:1; left: 27px; top: 130px">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<cfoutput><input type="hidden" name="empnum1" value="#varUser#"></cfoutput>
<td class="columnHeads">Date#</td>
<td class="columnHeads">Activity</td>
<td class="columnHeads"><div align="center">Time (Hours)</div></td>
<td class="columnHeads">Description</td>
</tr>
<tr>
<td>
<div align="left">
<cfselect name="date" message="Must Specify Date" query="qryDates" value="Date" selected="#varNow#" required="Yes">
</cfselect>
</div>
</td>
<td>
<div align="left">
<cfselect name="subactivity" message="Must Specify Activity" query="qryActivity" value="subactivity" display="subactivity" required="Yes">
</cfselect>
</div>
</td>
<td>
<div align="left">
<cfselect name="time" message="Must Specify Time" query="qryTime" value="time" display="Time" required="Yes">
</cfselect>
</div>
</td>
<td>
<div align="left">
<cfinput type="Text" name="description" required="yes" Message="Description Required">
</div>
</td>
</tr>
<tr></tr>
<tr>
<td></td>
<td></td>
<td></td>
<td>
<div align="right">
<input type="submit" name="submit" value="Submit">
</div>
</td>
</tr>
</table>
</div>
<div id="Layer2" style="position:absolute; width:632px; height:29px; z-index:2; left: 28px"><span class="GeneralText">The
survey needs to be completed between 04/05/2004 and 04/16/2004. You must provide
specific details in the description for each time allocation you have specified
(i.e. 30 Minutes: Loans : Ran Start of Day in CLAS).</span> </div>
<p> </p>
<p> </p>
<p> </p>
<div id="Layer2" style="position:absolute; width:632px; height:29px; z-index:2; left: 28px"><span class="GeneralText">The
information below is a detail log of your Labor Distribution data. The table
to the right shows you an hourly summary by day. </span></div>
<p> </p></cfform></body>
</html>
<div id="Layer2" style="position:absolute; width:547px; height:238px; z-index:2; left: 28px; top: 247px"><cfinclude template="display.cfm"></div>
<div id="Layer3" style="position:absolute; width:156px; height:115px; z-index:3; left: 580px; top: 248px"><cfinclude template="summary.cfm"></div>
<br><br><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
[/color red]
Page 2 <Action Page>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<CFIF submit is "Update Entry">
<cfupdate datasource="labor" dbtype="ODBC" tablename="tbl_LD_Data" formfields="empnum1,date,subactivity,time,description,tran_id">
<CFELSE>
<cfinsert datasource="labor" tablename="tbl_LD_Data" formfields="empnum1,date,subactivity,time,description">
</CFIF>
<cflocation url="index.cfm" addtoken="No">
</body>
</html>
[/color blue]
Here's page 1 <Form Page>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
<link rel="stylesheet" href="default.css" type="text/css">
</head>
<cfquery name="qryDates" datasource="labor" dbtype="ODBC">
SELECT Date
FROM tbl_LD_Dates
ORDER BY sorter
</cfquery>
<cfquery name="qryUser" datasource="labor" dbtype="ODBC">
SELECT EmpNum, EmpName
FROM tbl_LD_Employees
WHERE (EmpNum = '#session.logonid#')
</cfquery>
<cfquery name="qryActivity" datasource="labor" dbtype="ODBC">
select subactivity, name from tbl_ld_subactivity order by subactivity;
</cfquery>
<cfquery name="qryTime" datasource="labor" dbtype="ODBC">
select time from tbl_ld_time
</cfquery>
<CFSET todayDate = Now()>
<cfset varNow = #dateformat(todayDate, "m/d/yyyy")#>
<body text="#FFFFFF"><cfform name="Survey" method="post" action="LD_Action.cfm">
<div align="center"><b><span class="title">Reserve Accounts & Loans - Labor Survey</span></b>
</div>
<hr>
<div align="center"><span class="title"><b><cfoutput>#qryuser.empname#</cfoutput></b> (<a href=../login/login.cfm>Not You?</a>)</span></div>
<hr>
<cfset varUser="#session.logonid#">
<div id="Layer1" style="position:absolute; width:633px; height:98px; z-index:1; left: 27px; top: 130px">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<cfoutput><input type="hidden" name="empnum1" value="#varUser#"></cfoutput>
<td class="columnHeads">Date#</td>
<td class="columnHeads">Activity</td>
<td class="columnHeads"><div align="center">Time (Hours)</div></td>
<td class="columnHeads">Description</td>
</tr>
<tr>
<td>
<div align="left">
<cfselect name="date" message="Must Specify Date" query="qryDates" value="Date" selected="#varNow#" required="Yes">
</cfselect>
</div>
</td>
<td>
<div align="left">
<cfselect name="subactivity" message="Must Specify Activity" query="qryActivity" value="subactivity" display="subactivity" required="Yes">
</cfselect>
</div>
</td>
<td>
<div align="left">
<cfselect name="time" message="Must Specify Time" query="qryTime" value="time" display="Time" required="Yes">
</cfselect>
</div>
</td>
<td>
<div align="left">
<cfinput type="Text" name="description" required="yes" Message="Description Required">
</div>
</td>
</tr>
<tr></tr>
<tr>
<td></td>
<td></td>
<td></td>
<td>
<div align="right">
<input type="submit" name="submit" value="Submit">
</div>
</td>
</tr>
</table>
</div>
<div id="Layer2" style="position:absolute; width:632px; height:29px; z-index:2; left: 28px"><span class="GeneralText">The
survey needs to be completed between 04/05/2004 and 04/16/2004. You must provide
specific details in the description for each time allocation you have specified
(i.e. 30 Minutes: Loans : Ran Start of Day in CLAS).</span> </div>
<p> </p>
<p> </p>
<p> </p>
<div id="Layer2" style="position:absolute; width:632px; height:29px; z-index:2; left: 28px"><span class="GeneralText">The
information below is a detail log of your Labor Distribution data. The table
to the right shows you an hourly summary by day. </span></div>
<p> </p></cfform></body>
</html>
<div id="Layer2" style="position:absolute; width:547px; height:238px; z-index:2; left: 28px; top: 247px"><cfinclude template="display.cfm"></div>
<div id="Layer3" style="position:absolute; width:156px; height:115px; z-index:3; left: 580px; top: 248px"><cfinclude template="summary.cfm"></div>
<br><br><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
[/color red]
Page 2 <Action Page>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<CFIF submit is "Update Entry">
<cfupdate datasource="labor" dbtype="ODBC" tablename="tbl_LD_Data" formfields="empnum1,date,subactivity,time,description,tran_id">
<CFELSE>
<cfinsert datasource="labor" tablename="tbl_LD_Data" formfields="empnum1,date,subactivity,time,description">
</CFIF>
<cflocation url="index.cfm" addtoken="No">
</body>
</html>
[/color blue]