473,412 Members | 3,763 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

How to create a decimal number in Access?

When I executed the following in Access:

alter table t1 alter column c1 decimal(8,4);

I got an error message: "Syntax error in ALTER TABLE statement". I got
a similar error when I tried to add a decimal field. I know I can
define a DECIMAL data type via Access GUI interface. But isn't there a
way to do it directly with a SQL statement?

Thanks.

Feb 21 '06 #1
3 15137
I couldn't find a reference to ALTER TABLE in ADO or DAO

I think you need to use ADOX to add columns and change attributes of a
table.
mi****@excite.com wrote:
When I executed the following in Access:

alter table t1 alter column c1 decimal(8,4);

I got an error message: "Syntax error in ALTER TABLE statement". I got
a similar error when I tried to add a decimal field. I know I can
define a DECIMAL data type via Access GUI interface. But isn't there a
way to do it directly with a SQL statement?

Thanks.


Feb 21 '06 #2
from help

"A new Microsoft Jet 4.0 data type
Decimal data types are new to Microsoft Jet 4.0. It is an exact numeric
data type that holds values from -10^28 - 1 through 10^28 - 1. You can
define both precision (1 - 28) and scale (0 - defined precision). The
default precision and scale are 18 and 0, respectively. Supported
synonyms are Dec and Numeric. Data accessed via ODBC that is typed as
Sql_Decimal or Sql_Numeric will now be mapped to the Microsoft Jet
Decimal, instead of Currency. This data type is not supported via Data
Access Objects (DAO). It is supported only with ActiveX Data Objects
(ADO)."

Thus - CurrentProject.Connection.Execute "ALTER TABLE TableName ALTER
COLUMN ColumnName Decimal (28,9)"

You chould be aware that there are sorting problems with this data
type; solvable in some people's minds, not solvable in others; an index
on the field seems to clear up most of these.

Feb 21 '06 #3

Lyle Fairfield wrote:
from help

"A new Microsoft Jet 4.0 data type
Decimal data types are new to Microsoft Jet 4.0. It is an exact numeric
data type that holds values from -10^28 - 1 through 10^28 - 1. You can
define both precision (1 - 28) and scale (0 - defined precision). The
default precision and scale are 18 and 0, respectively. Supported
synonyms are Dec and Numeric. Data accessed via ODBC that is typed as
Sql_Decimal or Sql_Numeric will now be mapped to the Microsoft Jet
Decimal, instead of Currency. This data type is not supported via Data
Access Objects (DAO). It is supported only with ActiveX Data Objects
(ADO)."

Thus - CurrentProject.Connection.Execute "ALTER TABLE TableName ALTER
COLUMN ColumnName Decimal (28,9)"

You chould be aware that there are sorting problems with this data
type; solvable in some people's minds, not solvable in others; an index
on the field seems to clear up most of these.


Thanks a lot!

Feb 21 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
1
by: stuart | last post by:
I am trying to format a number in an unbound text field using the following format statement in the field's Exit event: txt11UnitWeight = Format(txt11UnitWeight, "00000.00") I want the number...
687
by: cody | last post by:
no this is no trollposting and please don't get it wrong but iam very curious why people still use C instead of other languages especially C++. i heard people say C++ is slower than C but i can't...
2
by: Steve Summit | last post by:
-----BEGIN PGP SIGNED MESSAGE----- It's often explained that the reason for some of the imprecision in C's definition is so that C can be implemented on different kinds of machines -- say, those...
3
by: Brenny | last post by:
Hello I'm developing a project by using access database and there is a table(Table1) and it has a field(ml_mik) this is the decimal field. I'm taking a value from windows form as a decimal...
11
by: mesut demir | last post by:
Hi All, When I create fields (in files) I need assign a data type like char, varchar, money etc. I have some questions about the data types when you create fields in a file. What is the...
2
by: pax | last post by:
Hello there! Here is my problem, in the simplest scenario: - an Access 2000 format database (created with Access 2003) - a simple table that contains one single field defined as Number, Decimal,...
25
by: Lennart Benschop | last post by:
Python has had the Decimal data type for some time now. The Decimal data type is ideal for financial calculations. Using this data type would be more intuitive to computer novices than float as its...
4
by: ApexData | last post by:
I have a field set to 1 decimal place in the table definition. I have a textbox bound to the field also set to 1 decimal place. Why can I enter the number 1.57 in the textbox, and this becomes...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.