Hello again everyone! I have a syntax issue that seems to be stumbling me... I have written a "Calculate Weight" function tied to a button Click event and the purpose of this is to calculate the product weight of all products assigned to an order (which are displayed in the listbox).
So this is how the listbox looks (all fields are shown, none are hidden with column width 0".)
ID |
Product Name |
Container |
Quantity |
Weight |
442 |
Product Test 1 |
Syram Wrap |
2 |
8 |
231 |
Product Test 2 |
Product Box |
4 |
22 |
55 |
Product Test 3 |
Product Box |
6 |
442 |
Anywho, the problem seems to be somewhere in my code because when I click Calculate Weight - it returns the weight value of the item on the bottom of the list only. It doesn't seem to sum them all together. Does anyone see anything wrong with my code? I am a newb and this isn't "my" code more than it was just stripped from some example.
Code:
Private Sub bttnCalculateWeight_Click()
Dim listrs As Integer
Dim listsum As Integer
Dim x
DoCmd.Requery "listBOLProducts"
listrs = Me!
[listBOLProducts].ListCount
x = 1
Do
listsum = (Me!
[listBOLProducts].Column(4, x))
x = x + 1
Loop Until x = listrs
Me![inputTotalWeight].Value = listsum & " Lbs."
End Sub