Board index » delphi » 2 decimal places in ftcurrency field?

2 decimal places in ftcurrency field?

Hi! I've created dynamically a database with few ftcurrency
fields. When I open the table using Database Desktop, I always
saw the entries in the ftcurrency fields to be 2 decimal places,
which is what I want. However, when I use a Dbgrid to show the
table, the fields always gave me 4 decimal places.

How can I change it to 2? I'm using

Add('S1_T',ftcurrency, 0, False);

to create the fields.

Thanks a trillion!

Nigel
nig...@{*word*104}way.com.sg

 

Re:2 decimal places in ftcurrency field?


Try setting the Precision property of the field object to 2.

Table1.FieldByName('SomeMoney').Precision := 2;

--
Bill Todd
(Sorry but TeamB cannot answer questions received via email)
(Remove nospam from my email address to contact me for any other reason)

Re:2 decimal places in ftcurrency field?


Quote
>always
>saw the entries in the ftcurrency fields to be 2 decimal places,
>which is what I want. However, when I use a Dbgrid to show the
>table, the fields always gave me 4 decimal places.

My guess is that you have the the number of decimals for currency set to 4 in
Windows.  You can set the CurrencyDecimals      variable in delphi to determine
the number of decimals to display.

--
Brian Bushay (TeamB)
Bbus...@DataGuidance.com

Other Threads