• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 387
  • Last Modified:

how can i count a column in a list box in access 2010

i want to count a list box via a text box control source i tried this code:
=Count([ListRecurringPayments].[column](6))
but it's not working and it's return a error
0
bill201
Asked:
bill201
  • 2
  • 2
2 Solutions
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
This will give you the list count of the List box:

=[ListRecurringPayments].[ListCount]

I don't think you can directly get the count of a specific column ... say a True/False column ... and count the number of True's.

mx
0
 
DockieBoyCommented:
What are you trying to do here?  Count the number of items?  Get a total?  Count instances?
0
 
bill201Author Commented:
ok it's not a problem i will make a dcount
0
 
bill201Author Commented:
DockieBoy
i want to get a total
0
 
DockieBoyCommented:
You could try this.
Dim MyTotal as Currency ' if you are totaling currency values'
For i =  0 to Me.ListRecurringPayments.ListCount - 1
 MyTotal = MyTotal + Me.ListRecurringPayments.Column(6, i)
Next i
 Me.MyTextBox = MyTotal

Put the code behind the on change event for the list box so that it will update your total if the list changes.
 
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now