How to add a long text column to access a table through a query

I am updating the table in .mdb format. Access the database with Access 2013. I want to add a new field, say, a Description field, to an existing table.

I can add a text column using the following query

ALTER TABLE TestTable ADD Description TEXT(255);

Alternatively, I could use

ALTER TABLE TestTable ADD Description varchar(255);

This works fine and adds a TestTable column called Description, which is limited to 255 characters. If I open the table in Design View, I see that the description type is listed as "Short Text". However, there is an option for the field to be of the "long text" type, which, as far as I can tell, has no character limit. It's easy to change the type manually from the Design view, but I want to know if I can do this with a query.

I tried to increase the number of characters in my original request, for example

ALTER TABLE TestTable ADD Description TEXT(300);

But then I get the error "Field size" Description "too long."

What I want to know, can I add a column through a query so that it has a character limit of more than 255? This query is executed as part of a macro that runs automatically, so I don’t want to change it manually. My attempts to find a solution through Google are still empty.

+4
source share
1 answer

Found an answer shortly after posting the question. Using request

ALTER TABLE TestTable ADD Description LONGTEXT;

Creates a new long text column. It should be noted that this type does not require a number of characters.

+8
source

Source: https://habr.com/ru/post/1527542/


All Articles