Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC Error 37000 when INSERT INTO. HELP!!!!

Status
Not open for further replies.

josel

Programmer
Oct 16, 2001
716
US
As it has been the case before, I can't see the problem with this command.

All fields are text fields. Using MS ACCESS ...

THE CODE:
---------------------------------------------------
<cfelseif url.method is &quot;Add&quot;>
<cfquery name=&quot;dupDist&quot; datasource=&quot;#application.dsn#&quot; dbtype=&quot;odbc&quot;>
select *
from wpDist
where DstCode = '#form.DstCode#'
</cfquery>

<cfif dupDist.recordcount is &quot;0&quot;>
<cfquery datasource=&quot;#application.dsn#&quot; dbtype=&quot;odbc&quot;>
insert into wpDist(DstCode, DstName, DstAcct, DstPhone, DstExt, DstContact, DstPhone2 DstPhone3, DstComments)
values('#form.Dstcode#', '#form.DstName#', '#form.DstAcct#', '#form.DstPhone#', '#form.DstExt#', '#form.DstContact#', '#form.DstPhone2#', '#form.DstPhone3#', '#form.Dstcomments#')
</cfquery>
</cfif>


THE ERROR:
------------------------------------------------------
ODBC Error Code = 37000 (Syntax error or access violation)

[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.

SQL = &quot;insert into wpDist(DstCode, DstName, DstAcct, DstPhone, DstExt, DstContact, DstPhone2 DstPhone3, DstComments) values('josel', 'Jose Lerebours', 'Your-Acct-ID', '954-431-2468', '78901', 'Jose D. Lerebours', '', '', 'These are the comments I entered int the text ara provided to enter at least three lines of comments')&quot;

Data Source = &quot;DECO&quot;

The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (26:4) to (26:57).

------------------------------------------------------ If you have the knowledge, consult and educate those who need it! - Jose Lerebours
 
You probably have a syntax error.

Start by checking that the data in your query are all of the correct types for their respective fields.

If that doesn't solve it, copy the SQL shown in the debugging output and paste that text into MS Access' SQL builder (go to SQL view). when you execute the query, Access will often put the cursor at the spot in the text where the syntax error occurs.

If that doesn't help, simplify the insert statement. Using SQL Builder in SQL View, try a query that has only half the fields, and then half as many again, until it works. Then add fields back in gradually until it breaks. Figure out why it broke and continue adding fields until the whole query works.
 
Would you believe me if I tell you I spent hours looking at that line of code and did not spot the missing comma?

Thank you dude! Next time this happens, I'm shutting down and going to bed - deal with it 24 hrs later ... :cool:

Regards;

josel If you have the knowledge, consult and educate those who need it! - Jose Lerebours
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top