Creating a table via SQL.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I specify the data type for field in a table that is created via SQL? For example, I am creating a table called Quarterly and I want to format my Frequency field as double. When I run the SQL, Access formats the field as a decimal with four decimal places. Later in the program I modify the frequency field and there are instances where I need more than four decimals.

Thanks!
 
You specify the field type as Double in your SQL statement, but you cannot
specify the Format property, e.g.:
strSQL = "CREATE Table MyTable (MyField DOUBLE, AnotherField TEXT(20));"

A Double contains around 15 digits of precision, regardless of how it is
displayed. Set the Format of the text box on your form/report. Alternatively
use DAO to create and set the Format and/or Decimal places properties.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

JD said:
How do I specify the data type for field in a table that is created via
SQL? For example, I am creating a table called Quarterly and I want to
format my Frequency field as double. When I run the SQL, Access formats the
field as a decimal with four decimal places. Later in the program I modify
the frequency field and there are instances where I need more than four
decimals.
 
JD said:
How do I specify the data type for field in a table that is created
via SQL? For example, I am creating a table called Quarterly and I
want to format my Frequency field as double. When I run the SQL,
Access formats the field as a decimal with four decimal places.
Later in the program I modify the frequency field and there are
instances where I need more than four decimals.

What SQL are you using? Bear in mind that there's a big difference
between field type and field format. "Format" refers to the way the
data is displayed, but the type defines how it is stored.
 
Back
Top