Writing Query in Microsoft Access, error in field description [closed]

 ̄綄美尐妖づ 提交于 2019-12-11 01:27:11

问题


I am writing a query in Microsoft Access. and I am getting a syntax error in "field description". Here is the code:

CREATE TABLE CONS 
( 
    Com_Type text, 
    Cons_2008 double(10,2), 
    Cons_2009 double(10,2), 
    Cons_2010 double(10,2) 
);

Thanks!


回答1:


CREATE TABLE CONS 
( 
  Com_Type TEXT(150), 
  Cons_2008 DOUBLE, 
  Cons_2009 DOUBLE, 
  Cons_2010 DOUBLE
);



回答2:


Specify the length of the text field, unless you want a field of length 255 when called through an Access query or a Memo field when called through an ADO connection.

Com_Type Text(50), 

The Double type has no size and scale specifications. Either drop them or use the Decimal type.

Cons_2008 Double

Or

Cons_2008 Decimal(10, 2)

Note: See this SO answer for a limitation related to the decimal type.


When using the Double type, you can still specify a format in the TextBoxes linked to this table column. That way you can force the display of 2 decimals.



来源:https://stackoverflow.com/questions/21650135/writing-query-in-microsoft-access-error-in-field-description

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!