Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decimal datatype

Status
Not open for further replies.

alec

Programmer
Mar 7, 2001
21
0
0
US
I have a column called "Credits" on my table ( on my SQL Server), the data type is set to TinyInteger.
So far user has been using this table to enter and edit data.
For 3 years user has been entering number of integer type using the front end that is created using Access form.
Now I need to make small modification where user can enter
number of decimal type like 1.5 instead of 3 like it used to be.

What I did was:
I clicked on my SQL enterprise manager and look for the table where the column "Credits" reside. Clicked on Design View, changed the data type from tinyint to decimal.
After that, I created a new ODBC link, linking the newly modified table to the access form.

When I checked on the data type of the newly modified column using access design view, the datatype become "text" data type.

When I tested on my form, I can enter decimal number but it is rounded up. So If I enter credits 1.50, I would get a result of 2.00 when I view it with my form edit.
The problem is the same when I change the data type into float ( in access this would become "Number") and I got similar problem.

Is this not a simple modification request? Can anyone send me an input about how can I resolve this problem? Thanks - Alec














 
Hi Alec,
Could it be that the field on your form has an incorrect setting for Data Type and Decimal Places? I'd guess you need a "Fixed" format and 2 decimal places. No idea why Access sees it as text but if it was in an Access table it would have to be Number data type and single or double field size to store your decimals. Gord
ghubbell@total.net
 
Hi Gord!
Thanks for the input. Yes, On my access form for that particular textbox, the Format property is set for "Fixed" and 2 decimal.

On my code, I set the variable as double.

On my sql when I set the data type as Decimal, it shown as "text" datatype in access. When I changed it to "float" it showed up as "Number" dataype in access.
Either way, it won't save 1.5, it rounded up to 2.00 - Alec








 
I use ODBC on FoxPro tables to generate reports in Access. Numbers that come over from FoxPro come over in a differant datatype than the single or double. They come accross as decimal numbers. If I try comparing an Access double number to an inported FoxPro decimal, I get an error in my query. Maybe the problem your having is something like mine. After I change the data-subtype of my Access table from double to decimal, the query worked. I hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top