report whit real field

Hi,
i need your help.
i have set a field of a recordset like this:

rsTraffico.Field(“Costo”).Value=Importo1+Importo2+Importo3

“Costo” is a REAL coulumn of a sqlite db

where Importo1, Importo2, Importo3 are:
Importo1 = Round(costo1 * ListboxConsumiView.Cell(i,4).Val10000)/10000
Importo2 = Round(costo2 * ListboxConsumiView.Cell(i,4).Val
10000)/10000
Importo3 = Round(costo3 * ListboxConsumiView.Cell(i,4).Val*10000)/10000

In database table i see the number with 4 decimal this is correct.

The problemi is when i make report from this table, the field “Costo” is print with more than 4 decimal, why?
thansk

I will bet IMPORT1 to IMPORT3 are defined as DOUBLE… and as we all know (or should by now), DOUBLE is not a precise value.
For 4 digit precision, try using CURRENCY datatype instead

If it’s the report output you are concerned with, try adjusting Costco’s OutputFormat mask. It uses the same syntax as the Format function.

the value in rsTraffico.Field(“Costo”) is correct for me.
My problem is only on report.
can you help me to use OutputFormat with Report?

[quote=337343:@Francesco Di Lecce]the value in rsTraffico.Field(“Costo”) is correct for me.
My problem is only on report.
can you help me to use OutputFormat with Report?[/quote]

From the Format help page:

// The following example returns the number 3560.3 formatted as $3,560.30 Dim s as String s=Format(3560.3, "\\$###,##0.00")

The mask \\$###,##0.00 is the instruction for what gets printed. In this case it’s a dollar amount with 2 decimals. For 4 decimals, change it to \\$###,##0.0000. (The Format link above has all the mask info, please read it.)

Just put whatever format mask you want in the OutputField box of the ReportField properties.

yes!
solved,
thanks