473,320 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ListBox in Access

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
4 1756
ADezii
8,834 Expert 8TB
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
32,556 Expert Mod 16PB
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
8,834 Expert 8TB
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
32,556 Expert Mod 16PB
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

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

Similar topics

1
by: M Wells | last post by:
Hi All, I am developing an Access 2003 project application with the back end in SQL Server 2003. I have a master form that tracks projects, and several subforms on it that track various...
3
by: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name...
3
by: Alan Lane | last post by:
Hello world: I have a Parent form with a combobox, where the user selects a Contract or Estimate number. Then, on a subform, I have a listbox that gets filled with the details of the selected...
6
by: Chris Leuty | last post by:
I am populating a multiselect Listbox from a dataset, with the content of the listbox filled by one table, and the selections determined from another table. So far, I have been keeping the dataset...
5
by: Eddie Clark | last post by:
I'm trying to access the items in a listbox from a client-side vb script. <asp:listbox id="ListBox1" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 120px" runat="server" Width="400px"...
1
by: JMann101 | last post by:
I am writing a ASP.NET(VB) application and am having some trouble. I have a datagrid which list users and when an admin clicks "edit" a defined column becomes visible and a dynamic listbox control...
6
by: Mark | last post by:
Hello. I have a listbox whose rowsource is set to a saved query (call it "qry_customer_list.") When I add customers to my database, I call the listbox Requery method so that the listbox will...
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
2
by: billa856 | last post by:
Hi, My Project is in MS Access. In that I have one form in which I have some textboxes,comboboxes and listboxes. Now when I select value from 1st combobox(CustomerID) then it wil generate list for...
7
by: EManning | last post by:
I'm using A2003 connected to a SQL 2000 backend. This is not an adp. I have a table which I store 0 and -1 for 2 bit fields. I have a listbox on a form based on a query of this table. The...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.