PDA

View Full Version : INTEREST CALCULATIONS



Greg
11-05-2007, 08:34 PM
HI all,

Can anyone tell me how I might return a "DailyRate" expressed to 3 decimal points? The following code will only give me 2 decimal points.

Call FillABookmark("StartDate", txtStartDate.Text)
Call FillABookmark("EndDate", txtEndDate.Text)
Call FillABookmark("NumDays", DateDiff("d", txtStartDate, txtEndDate))
Call FillABookmark("DailyRate", FormatCurrency((CLng(txtAmount) * CLng(txtRate) / 100) / 365))

Regards,

Greg.

TonyJollans
11-06-2007, 12:05 AM
The calculation results in all the decimal places you want but then you format it as Currency. It would seem that your local currency has 2 decimal places.

I would suggest moving to a part of the world where the local currency has 3 decimal places. Failing that ...

Format((CLng(txtAmount) * CLng(txtRate) / 100 / 365), "?#.000")

... may do what you want (substituting the appropriate currency symbol of course)

TonyJollans
11-06-2007, 12:11 AM
ACtually, Word can give you the currency code to save you the trouble of knowing your own :) ...

Format((CLng(txtAmount) * CLng(txtRate) / 100 / 365) , Application.International(wdCurrencyCode) & "#.000")

fumei
11-06-2007, 12:12 AM
:rotlaugh:

Greg
11-06-2007, 01:53 AM
Well done. It's just what the doctor ordered.

Many thanks.

Greg.