I have a list box with three columns Name,Department,Salary. I use the listcount to get a count of all the records. But is there a method to count just the records within the listbox where department = 1 for example
Private Sub List7_DblClick(Cancel As Integer)
Dim listrs As Integer
Dim listsum As Integer
listrs = Me![List7].ListCount
x = 1
Do
If Me![List7].Column(2,x) = 1 Then
listsum = listsum + 1
x = x + 1
Else
x= x+1
End IF
Loop Until x = listrs
Me![Text9].Value = listsum
End Sub
You can highlight Column and hit the F1 to see examples of the property.
The Column property starts (column,row) at 0.
This code assumes column headers thus x = 1.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.