Listbox selected count

I have a form with a multiselect listbox.

I also have a textbox that gives me a count of the items on the list using:
Controlsource.....=lstbox.listcount

I would like a textbox next to that one that gives me a count of the items 
selected updated as i select items.  Is this possible?  If so please help.  I 
just can't seem to figure it out.  Thank you in advance.   
0
Utf
3/19/2010 5:51:02 PM
access.forms 6864 articles. 1 followers. Follow

3 Replies
4853 Views

Similar Articles

[PageSpeed] 48

> Is this possible? =A0
Ofcourse it is possible. Just enter in Click event of Your list box
following code:

         Me.txtCountSelected =3D Me.MyListBox.ItemsSelected.Count

Hope this helps.

Regards,
Sebastian



0
sweet_dreams
3/19/2010 6:44:26 PM
"livin''''life" <livinlife@discussions.microsoft.com> wrote in message 
news:95FB8BCD-B252-4F99-9C66-5B8BCDBC5E6B@microsoft.com...
>I have a form with a multiselect listbox.
>
> I also have a textbox that gives me a count of the items on the list 
> using:
> Controlsource.....=lstbox.listcount
>
> I would like a textbox next to that one that gives me a count of the items
> selected updated as i select items.  Is this possible?  If so please help. 
> I
> just can't seem to figure it out.  Thank you in advance.


I would expect a text box with a controlsource along these lines:

    =lstbox.ItemsSelected.Count

.... would work, without any need for code.  It seems to, in a quick test I 
made using Access 2003.

-- 
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

0
Dirk
3/21/2010 1:16:23 AM
Thank you for your assistance.  Both solutions worked well.

"Dirk Goldgar" wrote:

> "livin''''life" <livinlife@discussions.microsoft.com> wrote in message 
> news:95FB8BCD-B252-4F99-9C66-5B8BCDBC5E6B@microsoft.com...
> >I have a form with a multiselect listbox.
> >
> > I also have a textbox that gives me a count of the items on the list 
> > using:
> > Controlsource.....=lstbox.listcount
> >
> > I would like a textbox next to that one that gives me a count of the items
> > selected updated as i select items.  Is this possible?  If so please help. 
> > I
> > just can't seem to figure it out.  Thank you in advance.
> 
> 
> I would expect a text box with a controlsource along these lines:
> 
>     =lstbox.ItemsSelected.Count
> 
> ... would work, without any need for code.  It seems to, in a quick test I 
> made using Access 2003.
> 
> -- 
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
> 
> (please reply to the newsgroup)
> 
0
Utf
3/23/2010 8:42:01 PM
Reply:

Similar Artilces:

Total count of multiple fields?... Is that possible?
Here are the fields I need to manipulate Field 1: Account (Text field with validation rule) Field 2: Closed (Date field) Field 3: Termination (Yes/No) I want to be able to get a total count of records not closed or terminated. The condition should be to count everything except for the ones that are "Closed" and also marked for "Termination". My concern is that if the termination field is "checked" ... it may or may not have an entry in the closed field which may count the records twice. The termination field is used because the case may have bee...

scrollbar listbox
i'm trying to get rid of the horizontal scrollbar in listbox is it even possible to do that? tia jocke --- Message posted from http://www.ExcelForum.com/ ...

filter a listbox
Hi, i have made a form where i have 4 combolistbox (named: BOX1, BOX2, BOX3, BOX4) and a listbox (Named: LIST1, it is based on a table). i want to filter the data in the listbox by selecting some filter criteria in one of the 4 combolistboxes. i have tried to find out what to do, but i can't make anything of the solutions to work. I hope someone can help me with my problem. David, Why not base your listbox on a query. Within the query you can reference the comboboxes. In the after update of the combobox you can place a me.listbox.requery which will requery the source of the listbo...

Select Names Addressing
I have set-up my 500 contacts in Outlook 2000 hoping that they would be placed alphabetically as per "File As". Instead they are listed alphabetically by the persons first name. I want most of them listed as per company name like I specified while creating the contact. How can this be changed? Thanks Did you change the sort order for the Outlook Address Book to "File As?" What mail support mode are you using? -- Russ Valentine [MVP-Outlook] "Get Me Out Of This Box" <anonymous@discussions.microsoft.com> wrote in message news:23cd201c45ef1$3c42da40$a...

Use Sheet CodeNames to Select Sheet in Different Workbook
I'm using an .xla to make modifications to another workbook. In my procedure, I'm need to test the name of each worksheet to determine how to proceed. For some reason, I am unable to correctly point to capture the sheet name in the other workbook. I have tried a few different methods, none with any success. Here is the abbreviated code: Sub UnprotectSheets(strUpdateWb As String) 'where strUpdateWb is the name of an open workbook Windows(strUpdateWb).Activate Dim wb As Workbook Set wb = ActiveWorkbook 'Attempt #1 Dim temp As String temp = wb.Sheet1...

Selecting Specific Data
What I want to do is to have a drop down box (like an autofilter) that will select a certain range of dates, from some data I have. e.g. from now --> 6mths later 6mths later --> 12 mths later .. and so on --- Message posted from http://www.ExcelForum.com/ ...

Revalue: Currency not listed to select
I am trying to use the revalue feature for multicurrency. When I try to revalue (Tools>Routines>Financial>Revalue), there is no currency listed as available to revalue. I have confirmed that the currency is set up correctly, active, that all companies have access to, and there is a valid exchange rate setup. I have also confirmed that all accounts have been granted access to the currency. The currency is working in all other aspects; just not showing up as an option to be revalued. Any suggestions/help would be most appreciated. Thanks, Erica Just wanted to post our resolution. ...

selecting what to print
Hi, I had this listed under "double sided business cards" but perhaps the question has now evolved into something different. When I am ready to print my business cards - say 5 in the left column and 5 in the right - can I select which cards I want to print. Only the 5 in the left column for example. Using Publisher 2000 thanks Mike No. But there is a way around it. Create an 8�"x11" page, then, Arrange Layout guides 5 rows 2 columns adjust the margins to that of your card stock. Copy your cards to the locations you want to print. Print....

ListBox
On my form I have a combobox with a value list. After I make my selection I would like to run a query (after_update) and have it populate a list box? Is this possible and how? The query is simple and will only select one field from my table with about 20 records. Then is it possible to select certian values in this list box (may CTRL Click the ones I want) and then have a report print out based on what I selected in the list box with other selection on my form? Thanks, Sean, In the combo's AfterUpdate event, you need to add code to set the listbox's RowSource property. ...

Word Count
Surely in an advanced program like Publisher 2007 there is some facility for doing a word count on a document. Where is it ? Copy the text; paste into Word. Do a word count. -- Mary Sauer http://msauer.mvps.org/ "jimcee" <jimcee@discussions.microsoft.com> wrote in message news:DA2C8A75-95E7-4F11-97B3-8600AD79DD5E@microsoft.com... > Surely in an advanced program like Publisher 2007 > there is some facility for > doing a word count on a document. Where is it ? I find this approach to the problem of doing a word count on a document in Publish...

get (not selected) Shape ID
Hi everybody, I need to get the shape ID of a not selected shape in order to pass it in a VBA MACRO. I have to pass it on Move event, so i wrote in ShapeSheet Events Section, EventXFMod: RUNMACRO("NameFunction(ID)"), but ID is not correct. Can anybody help me? Thanks Gvnn If you use the CALLTHIS function, the Shape object is passed as a parameter to your code. Check the developer help for syntax details. -- Mark Nelson Office Graphics - Visio Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "Mjk" <lelim1...

Counting Unique Values
When you show a column in a pivot table under value, it gives you several options as far as showing the data. For example you could sum or count. I am trying to get a count from a text column which works but what I would like to do it only count unique values. Example: The count for each item would be 1, not 2 for Cindy; 1 for Jordan and 1 for Tom. Cindy Cindy Jordan Tom I appreciate your help. The link below will take you to Microsoft's Office Online page showing how to count unique values using formulas: http://office.microsoft.com/en-us/excel/HP030561181033.aspx -- John M...

Word should add image-count tool or property
MS Word should add an image-count function, either as a tool similar to Tools > Language > word count, or as an automatically generated statistic in document properties. I believe this is available in Sun's Open Office, and was quite surprised I couldn't unearth it somewhere in Word's Tools > Options. I often receive drafts to edit that contain 100 or more unlabeled graphics (i.e. can't generate table of figures) and want to know what I've got on my plate w/o counting them manually. VB scripts are great for techies, but please - how hard could it be ...

Selecting a Printer
Using Access 2003 is there a way to select a printer after giving the print command. if you create a report you can specify which printer that report prints to. i want the user to have the option of selecting which printer when printing any reports. Does anyone know a way to do this please? On Tue, 11 Dec 2007 12:08:00 -0800, StuJol <StuJol@discussions.microsoft.com> wrote: The obvious way is to show the report in Preview mode. Then the user can select File>Print if she chooses to print it, and select any printer available. If you really have to do this programmatically, review...

Listing record counts as zero in reports
I've set up a simple database in Access 2003. It has one table with 5 fields. 1 Primary index autonumber, 1 Date field and 3 fields filled from lookup tables. I want a report that will count records in this one table and specifically for the different values of one of the fields whose three values are in a lookup table. There are several situations when the no of records for a particular value is ZERO. I still want an entry in my report, stating that the number of records with that field value is ZERO. Clearly as their are no records they are not counted and not included in the re...

Automatically Selecting the First Contact
Outlook 2003 On some computers, when clicking on the Contacts shortcut, the contact view is opened, and the first contact is highlighted. On others, the contact view is opened, but no contact is highlighted. What makes this happen? Is there a setting somewhere? Mike Lewis <Mike Lewis@discussions.microsoft.com> wrote: > Outlook 2003 > > On some computers, when clicking on the Contacts shortcut, the > contact view is opened, and the first contact is highlighted. > > On others, the contact view is opened, but no contact is highlighted. > > What makes this happ...

Place actual selection name in table instead of ID #?
I have a CBO that places the companies ID in my table instead of the actual companys name. I know this is how it is suppose to work but I need it to place the actual name that the user selects into the table. How is this done I know of a way? In that case you have to change the field in the designated table because initally you would store a number and now you want to store text. So change the field to text and then change the bound column of the CBO to 2 (which is probably the field which shows the name). This way you can still use the combo but it will store the name in the table (as...

Cannot Delete Selective Downloaded Transactions
Using MS Money 2004. I downloaded my investment transactions on a new account and am having problems reviewing the transactions. Apparently one of the transactions is bad and I want to delete it and process the rest of the transactions. Unfortunately, I cannot find any way to delete a specific transaction while in the "review" screen. There must be a way to delete a transaction or maybe edit it otherwise what is the purpose of "review". I tried selecting the transaction and right clicking the mouse but nothing happens. I have MS Money 2004 installed on an XP and a W98 sy...

listbox inconsistencies
I am a relatively new VBA user and this is my first post to this forum. I am using Excel 2002 sp3 with VBA (help shows VB 6.03 version 1024) on an XP sp3 machine. I have a project with one workbook that has one form - frmRecordJob. This form has a calendar control, a combo box, 2 listboxes, some labels, and 2 text boxes. The 2 list boxes (lstCode1 and lstCode2) are in a frame. lstCode2 was created by copy/paste from lstCode1. Checking their properties shows them to be identical except for the tab indices and top properties. The value and text properties are both empty, with no...

Counting unique values with variables
I have a similar question, except, I need to count unique instances where there is another variable. Sample Data: Program Student University 1 John North University 1 Steven North University 1 James South University 2 Susie Case University 2 Laura West University 2 Lisa North University So, in this sample data, I would need to count the number of unique universities per program, that is, Program 1 - 2 univeristies, program 2 - 3 universities. Additionally, ...

Move data between ListBoxes
I created a UserForm with two list boxes (ListBox1 & ListBox2). Right now when I show the Form ListBox1 is the only ListBox with choices inside of it. The problem I am having is that I’d like to be to be able to double click a selection from ListBox1 and have it be moved over to ListBox2. Similarly, I would like to be able to double click a selection after I have moved it to ListBox2 and have it be move back over to ListBox1. Can you help me develop the code that will perform the procedure I am trying to add to this form? see if this helps http://www.dailydose...

counting cells that contain a specific value
I have a spreadsheet containing hundreds of business contact names, addresses, etc., with the city and state in adjacent columns. I'm trying to find a good way to easily and quickly count the number of contacts in a particular city. One obvious way might be to sort by city name and count the rows, being careful not to count those contacts in a city with the same name, but a different state -- e.g., Columbia MD vs. Columbia SC. There are a lots of entries for each cities, so a manual count could easily be wrong. "Countif" looks like it could be used to do this if I set u...

Select a area and group
Hi All, I have a problem in selction of shapes in visio. I have to select a group of shapes that are in aparticular area programatically. Macros are not getting recorded when i select the shapes using Area select tool. I would be thankful if somebody help me in solving this problem. In code: Draw a rectangle to cover the area. Use SpatialNeighbors to select other shapes Delete the rectangle -- David Parker Microsoft MVP (Visio) http://bvisual.spaces.live.com http://www.visualizinginformation.com <subbumech2001@gmail.com> wrote in message news:1182331435.068512.155690@...

Counting Number?
Maybe I'm asking for too much, but I was looking into making a spreadsheet that represents kind of an order form. But for that to happen I'm going to need some sort of tracking number per form created, hopefully in order :). Is there any way to do this or am I asking for too much? ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ Sidepocket, you could use some VBA like this to add incress the number each time you run it Sheet1.[A1] = Sheet1.[A1].Value + 1 mayb...

Selecting values in rows
I have the following problem: I have a lot of sheets with measurements on different dates and times dates and times in different columns. The problem is that not all tim series are the same, some measurement are every 30 minutes and som every hour. so some are like 01:00, 02:00, 03:00, etc and others ar 00:30, 01:00, 01:30 etc. All i want to do for now is: I want to create 1 main sheet with the following content 2 columns with dates and times (smallest time step of course) a lot of columns with the measurement.. so excel would have to do: Look in main sheet what time and date are asked for...