This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01BFA0C6.7E6C9FC0
Content-Type: text/plain;
        charset="iso-8859-1"

Hello everyone,

I have a looping problem that I can't quite get!  

I have 5 lists as follows:
region = "Africa, Africa, Africa"
ID = "5, 10, 15"
month = "May, May, May"
proj_amt = "120, 200, 4000"
budget_amt = "200, 230, 5000" 

This data is coming from user input from a previous page and then gets
inserted into a DB.  So, each record will be region, ID, month, proj_amt,
budget_amt.  
There is logic as to why region and month have the same elements.

To make it easier I'm showing my code for the first three lists:
<cfset listregion = "Africa,Africa,Africa">
<cfset Cats = "5, 10, 15">
<cfset listmonth = "May, May, May">

<cfquery name="Insert_Budget" datasource="GOE">
        <cfloop index="a" list="#variables.listregion#">
                <cfloop index="b" list="#variables.Cats#">
                INSERT INTO Testgoe(Region, ExpenseID);
                VALUES ('#Evaluate('a')#', #Evaluate(b)#)       
              </cfloop>
        </cfloop>
</cfquery> 
And the erroe I get is:
ODBC Error Code = 37000 (Syntax error or access violation) 
[Microsoft][ODBC Microsoft Access 97 Driver] Syntax error in INSERT INTO
statement. 
SQL = "INSERT INTO Testgoe(Region, ExpenseID); VALUES ('Africa', 5) INSERT
INTO Testgoe(Region, ExpenseID);
VALUES ('Africa', 10) INSERT INTO Testgoe(Region, ExpenseID); VALUES
('Africa', 15) INSERT INTO 
Testgoe(Region, ExpenseID); VALUES ('Africa', 5) INSERT INTO Testgoe(Region,
ExpenseID); 
VALUES ('Africa', 10) INSERT INTO Testgoe(Region, ExpenseID); VALUES
('Africa', 15)
INSERT INTO Testgoe(Region, ExpenseID); VALUES ('Africa', 5) INSERT INTO
Testgoe(Region, ExpenseID); 
VALUES ('Africa', 10) INSERT INTO Testgoe(Region, ExpenseID); VALUES
('Africa', 15)" 
Data Source = "GOE" 
The error occurred while processing an element with a general identifier of
(CFQUERY), occupying document position (29:1) to (29:47). 
And why is it looping twice? I've tried millions of variations. <cf-tThis is
driving me nuts!! But I'm sure you've heard that before.  Your help is
greatly appreciated.

Laura





------_=_NextPart_001_01BFA0C6.7E6C9FC0
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2651.75">
<TITLE>CFLoop w/Insert Into??</TITLE>
</HEAD>
<BODY>

<P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">Hello everyone,</FONT>
</P>

<P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">I have a looping =
problem that I can't quite get!&nbsp; </FONT>
</P>

<P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">I have 5 lists as =
follows:</FONT>
<BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">region =3D =
&quot;Africa, Africa, Africa&quot;</FONT>
<BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">ID =3D &quot;5, 10, =
15&quot;</FONT>
<BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">month =3D &quot;May, =
May, May&quot;</FONT>
<BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">proj_amt =3D =
&quot;120, 200, 4000&quot;</FONT>
<BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">budget_amt =3D =
&quot;200, 230, 5000&quot; </FONT>
</P>

<P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">This data is coming =
from user input from a previous page and then gets inserted into a =
DB.&nbsp; So, each record will be region, ID, month, proj_amt, =
budget_amt.&nbsp; </FONT></P>

<P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">There is logic as to =
why region and month have the same elements.</FONT>
</P>

<P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">To make it easier I'm =
showing my code for the first three lists:</FONT>
<BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">&lt;cfset listregion =
=3D &quot;Africa,Africa,Africa&quot;&gt;</FONT>
<BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">&lt;cfset Cats =3D =
&quot;5, 10, 15&quot;&gt;</FONT>
<BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">&lt;cfset listmonth =
=3D &quot;May, May, May&quot;&gt;</FONT>
</P>

<P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">&lt;cfquery =
name=3D&quot;Insert_Budget&quot; =
datasource=3D&quot;GOE&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D"#000080" =
FACE=3D"Arial Narrow">&lt;cfloop index=3D&quot;a&quot; =
list=3D&quot;#variables.listregion#&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D"#000080" =
FACE=3D"Arial Narrow">&lt;cfloop index=3D&quot;b&quot; =
list=3D&quot;#variables.Cats#&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D"#000080" =
FACE=3D"Arial Narrow">INSERT INTO Testgoe(Region, ExpenseID);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D"#000080" =
FACE=3D"Arial Narrow">VALUES ('#Evaluate('a')#', =
#Evaluate(b)#)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D"#000080" =
FACE=3D"Arial Narrow">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;/cfloop&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D"#000080" =
FACE=3D"Arial Narrow">&lt;/cfloop&gt;</FONT>
<BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">&lt;/cfquery&gt; =
</FONT>
<BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">And the erroe I get =
is:</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Times New Roman">ODBC Error Code =3D 37000 =
(Syntax error or access violation) </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Times New Roman">[Microsoft][ODBC Microsoft =
Access 97 Driver] Syntax error in INSERT INTO statement. </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Times New Roman">SQL =3D &quot;INSERT INTO =
Testgoe(Region, ExpenseID); VALUES ('Africa', 5) INSERT INTO =
Testgoe(Region, ExpenseID);</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Times New Roman">VALUES ('Africa', 10) =
INSERT INTO Testgoe(Region, ExpenseID); VALUES ('Africa', 15) INSERT =
INTO </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Times New Roman">Testgoe(Region, ExpenseID); =
VALUES ('Africa', 5) INSERT INTO Testgoe(Region, ExpenseID); </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Times New Roman">VALUES ('Africa', 10) =
INSERT INTO Testgoe(Region, ExpenseID); VALUES ('Africa', 15)</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Times New Roman">INSERT INTO Testgoe(Region, =
ExpenseID); VALUES ('Africa', 5) INSERT INTO Testgoe(Region, =
ExpenseID); </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Times New Roman">VALUES ('Africa', 10) =
INSERT INTO Testgoe(Region, ExpenseID); VALUES ('Africa', 15)&quot; =
</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Times New Roman">Data Source =3D =
&quot;GOE&quot; </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Times New Roman">The error occurred while =
processing an element with a general identifier of (CFQUERY), occupying =
document position (29:1) to (29:47). </FONT></P>

<P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">And why is it looping =
twice? I've tried millions of variations. &lt;cf-tThis is driving me =
nuts!! But I'm sure you've heard that before.&nbsp; Your help is =
greatly appreciated.</FONT></P>

<P><B><I><FONT COLOR=3D"#800080" SIZE=3D2 =
FACE=3D"Arial">Laura</FONT></I></B><I></I>
</P>
<BR>
<BR>
<BR>

</BODY>
</HTML>
------_=_NextPart_001_01BFA0C6.7E6C9FC0--
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to