Get the total income of a sale (1 Viewer)

tsdeveloper

New member
Local time
Today, 18:08
Joined
Sep 3, 2013
Messages
1
Personal goodnight sorry my english I'm Brazilian, I wonder where is wrong here.
Whenever you put this piece of code to subtract the Y.Debito - The Y.TOTALLANC Total in Total datagrid appears zeroed

'Code
querySQL1.Append ("SELECT Y.descricao, Y.Debito, Y.Debito - Y.Valor_Lanc TOTAL AS" & _
************************** "FROM (SELECT fb.FinanFP_Descricao AS description, SUM (iif (VndFinan_Credito = true, VndFinan_ValorLanc) AS Valor_Lanc, SUM (iif (fv.VndFinan_Debito = true, fv.VndFinan_ValorLanc)) AS Debit" & _
************************** "Venda_Financeiro fv FROM INNER JOIN ON Financeiro_FormaPagto fb fv.VndFinan_FormaPagto fb.FinanFP_Id =" & _
************************** "GROUP BY fb.FinanFP_Descricao) the Y")

But if I just call it Y.TOTALLANC list usually through payment
**** _querySQL1.Append ("SELECT Y.descricao, Y.Debito, Y.Valor_Lanc TOTAL AS" & _
************************** "FROM (SELECT fb.FinanFP_Descricao AS description, SUM (iif (VndFinan_Credito = true, VndFinan_ValorLanc) AS Valor_Lanc, SUM (iif (fv.VndFinan_Debito = true, fv.VndFinan_ValorLanc)) AS Debit" & _
************************** "Venda_Financeiro fv FROM INNER JOIN ON Financeiro_FormaPagto fb fv.VndFinan_FormaPagto fb.FinanFP_Id =" & _
************************** "GROUP BY fb.FinanFP_Descricao) the Y")
Can you give a hint?
 
Last edited:

GohDiamond

"Access- Imagineer that!"
Local time
Today, 17:08
Joined
Nov 1, 2006
Messages
550
Are you naming the expression (Y.Debito - Y.Valor_Lanc) as the Field named "TOTAL"? if so then
SELECT Y.descricao, Y.Debito, Y.Debito - Y.Valor_Lanc AS TOTAL

look at your the line -- SUM (iif (fv.VndFinan_Debito = true, fv.VndFinan_ValorLanc)) AS Debit" --
that seems to be a similar pattern in the sql statement
so try AS TOTAL instead of TOTAL AS

Select A, B-C as someFieldname
 
Last edited:

Users who are viewing this thread

Top Bottom