By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,806 Members | 1,465 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,806 IT Pros & Developers. It's quick & easy.

ListBox in Access

P: 2
Dear All,
I have three ListBoxes in Ms. Access form, 1st one is Getting Earned Leave from Database, 2nd one is getting Used Leave from Database, 3 one is making Balance and showing remained Leave, but each Listbox has three columns as AnnualLeave, SickLeave, CompTime.
Please teach me that how to calculate each column's row?
thanks
Hekmatullah
Aug 4 '08 #1
Share this Question
Share on Google+
4 Replies


ADezii
Expert 5K+
P: 8,636
I'm not sure if I interpret your request exactly, but the following code will list each Row Number, and each of the 3 Column Values in a List Box named List0. The Row Source of the List Box is taken from values within the Employees Table of the Northwind Database.
Expand|Select|Wrap|Line Numbers
  1. Dim intNumberOfEntries As Integer
  2. Dim intCounter As Integer
  3.  
  4. intNumberOfEntries = Me![List0].ListCount
  5.  
  6. If intNumberOfEntries > 0 Then
  7.   With Me![List0]
  8.     For intCounter = 0 To intNumberOfEntries - 1
  9.  
  10.       Debug.Print "Row: " & intCounter + 1 & " | " & .Column(0, intCounter) & " | " & .Column(1, intCounter) & _
  11.                         " | " & .Column(2, intCounter)      
  12.     Next
  13.   End With
  14. End If
OUTPUT:
Row: 1 | Sales Representative | Nancy | Davolio
Row: 2 | Vice President, Sales | Andrew | Fuller
Row: 3 | Sales Representative | Janet | Leverling
Row: 4 | Sales Representative | Margaret | Peacock
Row: 5 | Sales Manager | Steven | Buchanan
Row: 6 | Sales Representative | Michael | Suyama
Row: 7 | Sales Representative | Robert | King
Row: 8 | Inside Sales Coordinator | Laura | Callahan
Row: 9 | Sales Representative | Anne | Dodsworth
Aug 6 '08 #2

NeoPa
Expert Mod 15k+
P: 31,489
A common way to populate ListBoxes is with a query. I suspect this will suit your purpose. Your query needs to include all the columns required for the ListBox, so you would need a column with the correct calculation in it. Calculations are not done within the ListBox control itself.

Does this help?
Aug 10 '08 #3

ADezii
Expert 5K+
P: 8,636
A common way to populate ListBoxes is with a query. I suspect this will suit your purpose. Your query needs to include all the columns required for the ListBox, so you would need a column with the correct calculation in it. Calculations are not done within the ListBox control itself.

Does this help?
Did I miss the boat on this one by that much? (LOL).
Aug 10 '08 #4

NeoPa
Expert Mod 15k+
P: 31,489
You & I both know that interpretation of members questions often requires large doses of intuition and (sometimes informed) guesswork.

Sometimes you hit, and sometimes you miss :D

Whoever knows for sure until the OP replies ;)
Aug 11 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.