I try to sum a field (lblQty * lblUnitP) that is in a gallert (Gallery5) into a label field outside the gallery.
Attached a screenshot.
The code in the lblUnitP field's Text = "R " & Text(ThisItem.UnitPrice,"[$-en-US]0,000.00")
The code in the lblSum (outside the gallery) Text = Sum(Value(lblQty.Text) * Value(lblUnitP.Text))
lblSum is showing 0.
What am I doing wrong?
7841*4 = 31364 as you have.
The issue is you need to do
So try something like
Sum(<Your gallery name>, <Table Column for quantity> * <Table Column for price>)
Sum(<Gallery>,Value(UnitQty) * Value(UnitPrice))
Tried everything so far:
Sum(Gallery5.AllItems, (Gallery5.AllItems.Qty) * (Gallery5.AllItems.UnitPrice))
Tried it without AllItems, above give me error on Qty and Unitprice (Invalid argument type. Expecting one of the following: Number, Text, Boolean. Above code is refrencing the sql database fields. I also tried referencing the 2 label fireld with value() function. Still no joy.
No no, Gallery.AllItems is a table
For example, if I had a table Tbl1 with columns
And I set Gallery1's Items to Tbl1
The sum would be Sum(Gallery1.AllItems, Quantity*Price) - referencing the column names, not the controls in the gallery
Are you manually allowing for the user to change Quantity etc? Is it a text box or just a label?