HELP! Baffled by Syntax error resulting from INSERT INTO

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
 
J

John W. Vinson

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
 
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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top