Return the total value of calculated items in a list

8

I have a table with Quant and Preço . In the form, besides these fields, I have the field Total = [Quant]*[Preço]

Also, in the main form I have the field SomaTotal = Soma([Total])

That is, the classic sum of prices that everyone knows how to do.

Question:

How do I put this total in a Sales list?

That is, I have this total for each sale, but I needed a list that would return all the sales, and the total for each one.

Would I have to do a nested query?

The image is illustrative. I need this list in MS Access.

    
asked by anonymous 07.01.2014 / 12:16

2 answers

1

I've done a SQL query:

SELECT detVendas.id, Sum([Quant]*[Preco]) AS Total FROM detVendas GROUP BY detVendas.id;
    
24.01.2014 / 19:48
3

In MSAccess you can create fields and put their value equal to another form / report field.

In your case, if you understand correctly, you will make a form that will calculate the total of 3 sales, and then you want the other part of the same form to show only the total of each sale (as if it were a summary) , and maybe the overall total (adding up to the 3 sales), this?

Enter a method in the AfterUpdate property of your total for each sale (which has a value of 4044 and 2280 in your example) and have it update the other field.

Example:

Private Sub TotalVenda1_AfterUpdate()

    Me.[TotalGeral1] = Me.[TotalVenda1]

End Sub
    
07.01.2014 / 13:16