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

Posted on 2011-02-23
Medium Priority
Last Modified: 2012-05-11
i want to count a list box via a text box control source i tried this code:
but it's not working and it's return a error
Question by:bill201
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 75

Accepted Solution

DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 1000 total points
ID: 34967518
This will give you the list count of the List box:


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.


Expert Comment

ID: 34968696
What are you trying to do here?  Count the number of items?  Get a total?  Count instances?

Author Comment

ID: 34969099
ok it's not a problem i will make a dcount

Author Comment

ID: 34969109
i want to get a total

Assisted Solution

DockieBoy earned 1000 total points
ID: 34972685
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.

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question