Search code examples
sqlexcelvbams-accessalter-table

Access Reserved Symbols Workaround not working as expected


I would like to add a field with:

ALTER TABLE Table_name ADD COLUMN ABCD012345(en) Memo;

Here is described what to do in that case:

To work arond this problem, do not use special characters. If you must use special characters in query expressions, enclose the special characters in brackets ([]). For example, if you want to use the greater than sign (>), use [>].

As I understand it I would Need to Change it to:

ALTER TABLE Table_name ADD COLUMN ABCD012345[(]en[)] Memo;

But this still leads to the same error: Syntax error in field Definition. If you Need a little more context: I do this with a ADODB.Recordset in a VBA macro. Where do I go wrong? How can I solve it?


Solution

  • You need to surround the entire name with brackets, not just the special characters:

    ALTER TABLE Table_name ADD COLUMN [ABCD012345(en)] Memo;
    -- Here --------------------------^--------------^