Decimal datatype not working

jal

Registered User.
Local time
Yesterday, 21:36
Joined
Mar 30, 2007
Messages
1,709
I can't seem to get the Decimal datatype to work. I thought it would store sevaral digits after the decimal point. In my testing, I am trying to insert the following value:

.123456789

But in datasheet view it just shows a value of zero after the insert. I know the insert is successful, because the other fields did just fine. This is the code I'm using (this is a native Access table)

Sql = "INSERT INTO testTable....."
Call cmd.Parameters.Append(cmd.CreateParameter("@Num", adDecimal))
cmd.Parameters("@Num").Value = .12345789
cmd.Execute

If I change the value to an integer it works fine, like this:

cmd.Parameters("@Num").Value = 2500

but the problem is that I need to insert decimal numbers. In design view, the datatype for this column is "Decimal" and the "Precision" is 18. So why isn't the engine preserving up to 18 digits past the decimal point?

I am using ADOB and I tried setting the param length but that didn't help either.
 
Last edited:
Try changing your (number) field to :

Field size : double
format : general number
decimal places : auto

Hth
 
Ok, I think I got it, I think Access requires me to set the Scale in design view.
 
Try changing your (number) field to :

Field size : double
format : general number
decimal places : auto

Hth
Yes, thanks, that would probably have solved it as well.
 

Users who are viewing this thread

Back
Top Bottom