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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which type of Number to use Decimal? 1

Status
Not open for further replies.

Fekri

Programmer
Jan 3, 2004
284
IR
Hi,

I'm really confuse to select data type for my fields.

I want to have decimal number in my fields only if the number edited have decimal otherwise the fields should show the number without any decimal.
I used single, but I don't know why in a query when the number is like: "19.4" or "19.8", if I want to make the field value to negative it will change to "-19.3999997" or "-19.79999924"

Is there any body know why?? and what I have to do to prevent this change?

thanks
Ali
 
It's just because floating point numbers (like Single or Double) aren't real numbers but approximations.
Use either the Decimal or Currency type.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV,

but in decimal if I select decimal and decimal place to "Auto" not shown any decimal number &

if I put for example 2 digit for decimal place always show 2 decimal digit number which I don't like to show this.

number to be shown should not shown
12 12 12.00
12.12 12.12 12

thanks
ali
 
You should make sure the Scale property for this field is set to an appropriate value. If it is set to 0 (default), Access does not store any digits to the right of the decimal. Set this property to the number of digits you would like stored and set Decimal Places to Auto. This should achieve the effect you desire.


-V
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top