noiseaholic22
Technical User
Hello,
I'm relatively new to Access and only know what I've learned from other access users, but I would like to calculate the sum of a column in a listbox and have it pop up in a text box.
I came across this answer to my question:
-------------------------------------------------
Private Sub List7_DblClick(Cancel As Integer)
Dim listrs As Integer
Dim listsum As Integer
listrs = Me![List7].ListCount
x = 1
Do
listsum = listsum + (Me![List7].Column(6, x))
x = x + 1
Loop Until x = listrs
Me![Text9].Value = listsum
End Sub
This is with column headers. If no column headers, take out x = 1.
---------------------------------------------------
But for some odd reason it won't calculate any amounts that are not whole numbers
(.5, 1.25, etc...)
Does anyone know why or how to fix this?
Thanks!
I'm relatively new to Access and only know what I've learned from other access users, but I would like to calculate the sum of a column in a listbox and have it pop up in a text box.
I came across this answer to my question:
-------------------------------------------------
Private Sub List7_DblClick(Cancel As Integer)
Dim listrs As Integer
Dim listsum As Integer
listrs = Me![List7].ListCount
x = 1
Do
listsum = listsum + (Me![List7].Column(6, x))
x = x + 1
Loop Until x = listrs
Me![Text9].Value = listsum
End Sub
This is with column headers. If no column headers, take out x = 1.
---------------------------------------------------
But for some odd reason it won't calculate any amounts that are not whole numbers
(.5, 1.25, etc...)
Does anyone know why or how to fix this?
Thanks!