|
Postada em 17/04/2007 17:29 hs
eu estou fazendo assim... ele esta num "command" Dim Val_Tol As Integer For i = 1 To Key Val_Tol = Val_Tol + Moeda(fg1.TextMatrix(i, 4)) Next i txtnp.Text = Moeda(Val_Tol) 'lblTotal.Caption = Moeda(Val_Tol) Command3.Enabled = True so que ele não soma certo
exp. no valor 19,98 o total dele e 16,00 onde eu estou errando
|
|
|
|
|
Postada em 17/04/2007 19:31 hs
O que faz a função moeda?
|
|
|
|
Postada em 18/04/2007 10:03 hs
Vai sempre te trazer um valor inteiro, mude o tipo da variável Val_Tol para Currency, e formate o resultado em lblTotal.Caption. vlu//
|
|
|
|
Postada em 18/04/2007 12:06 hs
a função moeda faz... 'Exemplo: formatar estelo moeda ' 2 decimais ' TxtValor = Moeda(RS!valor) ' 10 decimais: ' TxtValor = Moeda(RS!valor, 10) Public Function Moeda(cCampo As Variant, Optional Casas As Integer) As String If Casas > 0 Then Moeda = Format(cCampo, "###,##0." & String(Casas, "0")) Else Moeda = Format(cCampo, "###,##0.00") End If End Function
|
|
|
|
Postada em 18/04/2007 14:08 hs
Pelo q eu estou vendo acho melhor vc somar primeiro depois arrendondar Dim Val_Tol As Integer For i = 1 To Key Val_Tol = Val_Tol + ccur(fg1.TextMatrix(i, 4)) Next i txtnp.Text = Moeda(Val_Tol) 'lblTotal.Caption = Moeda(Val_Tol)
at+
|
|
|
|
Postada em 18/04/2007 18:31 hs
não deu certo, sera que eu não espriquei certo valor certo 19,98 so que traz 20,00 ele esta arrendondar a valor
|
|
|