ALTER TABLE space in field name

LB79

Registered User.
Local time
Today, 08:56
Joined
Oct 26, 2007
Messages
505
Hello,

I'm trying to amend a table column property, but I'm having trouble with a space.

I'm using:
DoCmd.RunSQL "ALTER TABLE Table ALTER COLUMN My Field Text;"

The space in My Field is causing a debug. I've tried ‘My Field’ and My Field, (with the comma), but im not getting it right.

Thanks for any advice.
 
DoCmd.RunSQL "ALTER TABLE Table ALTER COLUMN [My Field] Text;"

Use Brackets [ ] around fieldnames with spaces

JR
 
Oh of course! How did i not realise that!

Thanks for pointing that out :)
 
Another reason to avoid spaces and special characters when naming your db objects.
 

Users who are viewing this thread

Back
Top Bottom