Can any of you lend a hand. I have a form that displays multiple records from one table and need to be able to update one or more record from that form. I have written the query to update the table. With one record it works fine. With two or more I bomb. I have a loop but it acts like it's not working. I have each field unique by tacking on the recordid to it. Everything I found on the subject which was not much said to do that plus use the evalutate function. Nothing seems to work!
<CFIF IsDefined("Form.action")>
<CFLOOP index="i" list="#FORM.sectionID#">
<cfif IsDefined("Form.LR_#sectionID#") is True>
<cfset "form.LR_#sectionID#" = "on">
<cfelse>
<cfset "form.LR_#sectionID#" = "off">
</cfif>
<cfif IsDefined("form.BPOC_#sectionID#") is True>
<cfset "form.BPOC_#sectionID#"= "on">
<cfelse>
<cfset "form.BPOC_#sectionID#" = "off">
</cfif>
<cfif IsDefined("form.LPOC_#sectionID#") is True>
<cfset "form.LPOC_#sectionID#"= "on">
<cfelse>
<cfset "form.LPOC_#sectionID#" = "off">
</cfif>
<cfif IsDefined("form.closingcheck_#sectionID#") is True>
<cfset "form.closingcheck_#sectionID#" = "on">
<cfelse>
<cfset "form.closingcheck_#sectionID#" = "off">
</cfif>
<cfset amount = #evaluate("Form.Amount_#sectionID#")#>
<cfset POCamount = #evaluate("Form.POCAmount_#sectionID#")#>
<cfoutput> <CFQUERY NAME="#i#" DATASOURCE="Accutrac">
UPDATE SECTION
set Lastmodifiedon = #Date#,
Description = '#evaluate("Form.Description_#sectionID#")#',
Percentagefield = '#evaluate("Form.Percent_#sectionID#")#',
Toname = '#evaluate("Form.Toname_#sectionID#")#',
LR = '#evaluate("Form.LR_#sectionID#")#',
POC = '#evaluate("Form.BPOC_#sectionID#")#',
LPOC = '#evaluate("Form.LPOC_#sectionID#")#',
Closingcheck = '#evaluate("Form.closingcheck_#sectionID#")#',
Amount = #NumberFormat(amount, "9999.99")#,
POCAmount = #NumberFormat(POCamount, "9999.99")#
where sectionID = #i#
</CFQUERY>
</cfoutput>
</CFLOOP>
</cfif>
<CFIF IsDefined("Form.action")>
<CFLOOP index="i" list="#FORM.sectionID#">
<cfif IsDefined("Form.LR_#sectionID#") is True>
<cfset "form.LR_#sectionID#" = "on">
<cfelse>
<cfset "form.LR_#sectionID#" = "off">
</cfif>
<cfif IsDefined("form.BPOC_#sectionID#") is True>
<cfset "form.BPOC_#sectionID#"= "on">
<cfelse>
<cfset "form.BPOC_#sectionID#" = "off">
</cfif>
<cfif IsDefined("form.LPOC_#sectionID#") is True>
<cfset "form.LPOC_#sectionID#"= "on">
<cfelse>
<cfset "form.LPOC_#sectionID#" = "off">
</cfif>
<cfif IsDefined("form.closingcheck_#sectionID#") is True>
<cfset "form.closingcheck_#sectionID#" = "on">
<cfelse>
<cfset "form.closingcheck_#sectionID#" = "off">
</cfif>
<cfset amount = #evaluate("Form.Amount_#sectionID#")#>
<cfset POCamount = #evaluate("Form.POCAmount_#sectionID#")#>
<cfoutput> <CFQUERY NAME="#i#" DATASOURCE="Accutrac">
UPDATE SECTION
set Lastmodifiedon = #Date#,
Description = '#evaluate("Form.Description_#sectionID#")#',
Percentagefield = '#evaluate("Form.Percent_#sectionID#")#',
Toname = '#evaluate("Form.Toname_#sectionID#")#',
LR = '#evaluate("Form.LR_#sectionID#")#',
POC = '#evaluate("Form.BPOC_#sectionID#")#',
LPOC = '#evaluate("Form.LPOC_#sectionID#")#',
Closingcheck = '#evaluate("Form.closingcheck_#sectionID#")#',
Amount = #NumberFormat(amount, "9999.99")#,
POCAmount = #NumberFormat(POCamount, "9999.99")#
where sectionID = #i#
</CFQUERY>
</cfoutput>
</CFLOOP>
</cfif>