Hi Nicolo
Michel's example used ADO code to exeute a DDL query statement to create a
field of type Decimal. I think you will find that works.
However, if you copy the query statement into SQL View of a query and try it
there, it will not work. That's because the native library that Access uses
is DAO, and Microsoft did not update DAO to handle the Decimal data type.
So, it works in ADO code, but it does not work in DAO code, nor in the query
interface.
In any case, Access has trouble handling the Decimal type:
Incorrect Sorting (Decimal fields)
at:
http://allenbrowne.com/bug-08.html
For a comparison of the names used in DAO and ADO, see:
http://allenbrowne.com/ser-49.html
Note 7 explains your case.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
message
Thanks for your kind reply.
Anyone can try this with Access 2007?
I'd like to add that I'm from Italy so I'm using an italian version of
Access 2007. So if someone can succesfully run the sql in a USA version we
can make a deeper investigation to find if is a bug (feature...) of the
italian version and if there is a workaround.
Michel Walsh said:
I confirm that the following is working in Access 2003:
CurrentProject.Connection.Execute "CREATE TABLE [MyTable01] ([ID]
AUTOINCREMENT, [Importo] DECIMAL(18, 2), CONSTRAINT [PrimaryKey] PRIMARY
KEY
([ID]));"
Vanderghast, Access MVP
Nicolo Carandini said:
Cant understand why
CREATE TABLE [MyTable] (
[ID] AUTOINCREMENT,
[Importo] DECIMAL(18, 2),
CONSTRAINT [PrimaryKey] PRIMARY KEY ([ID])
);
is refused by ACCESS 2007, showing "sintax error in field definition"
and
highlighting the word DECIMAL.
I remember that with Access 2003 we needed to enable SQL ANSI 92 but
Access
2007 shoud be 92 compliant and last but not least DECIMAL is a reserved
word
of ACCESS 2007.
So what I'm missing here?