HELP! Baffled by Syntax error resulting from INSERT INTO

  • Thread starter Thread starter plh
  • Start date Start date
P

plh

Hi All,
Rather than put all the generating code in, here is what is generated:

UPDATE tblTools SET Tool = 'REAMER .281 [9/32]', Material = 2, Coating
= 1, Type = 5, TNumber = 5, Location1033 = 'My Location', Bin = 'My
Bin', Location TC = 'My MSC', Size = 0.28 WHERE IDTool = 53;

I am getting a syntax error and I have poured over this, obvioulsy I
am no seeing something obvious.
Thank You!
-plh
 
Hi All,
Rather than put all the generating code in, here is what is generated:

UPDATE tblTools SET Tool = 'REAMER .281 [9/32]', Material = 2, Coating
= 1, Type = 5, TNumber = 5, Location1033 = 'My Location', Bin = 'My
Bin', Location TC = 'My MSC', Size = 0.28 WHERE IDTool = 53;

I am getting a syntax error and I have poured over this, obvioulsy I
am no seeing something obvious.
Thank You!
-plh

Only thing I see is that you have a blank in the fieldname Location TC. Blanks
are meaningful! If you (unwisely) include them in fieldnames, you must wrap
the name in [square brackets]:

UPDATE tblTools SET Tool = 'REAMER .281 [9/32]', Material = 2, Coating
= 1, Type = 5, TNumber = 5, Location1033 = 'My Location', Bin = 'My
Bin', [Location TC] = 'My MSC', Size = 0.28 WHERE IDTool = 53;


It doesn't hurt a bit to wrap ALL fieldnames in brackets; I find that it makes
the code a bit more readable since the brackets indicate that the contents are
indeed either a fieldname or a parameter.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
Hi All,
Rather than put all the generating code in, here is what is generated:
UPDATE tblTools SET Tool = 'REAMER .281 [9/32]', Material = 2, Coating
= 1, Type = 5, TNumber = 5, Location1033 = 'My Location', Bin = 'My
Bin', Location TC = 'My MSC', Size = 0.28 WHERE IDTool = 53;
I am getting a syntax error and I have poured over this, obvioulsy I
am no seeing something obvious.
Thank You!
-plh

Only thing I see is that you have a blank in the fieldname Location TC. Blanks
are meaningful! If you (unwisely) include them in fieldnames, you must wrap
the name in [square brackets]:

UPDATE tblTools SET Tool = 'REAMER .281 [9/32]', Material = 2, Coating
= 1, Type = 5, TNumber = 5, Location1033 = 'My Location', Bin ='My
Bin', [Location TC] = 'My MSC', Size = 0.28 WHERE IDTool = 53;

It doesn't hurt a bit to wrap ALL fieldnames in brackets; I find that it makes
the code a bit more readable since the brackets indicate that the contents are
indeed either a fieldname or a parameter.
--

             John W. Vinson [MVP]
 Microsoft's replacements for these newsgroups:
 http://social.msdn.microsoft.com/Forums/en-US/accessdev/
 http://social.answers.microsoft.com/Forums/en-US/addbuz/
 and see alsohttp://www.utteraccess.com

You nailed it! Actually the field name is "LocationTC" but the code
was generating "Location TC" thus raising the error.
Thank you,
-plh
 
Back
Top