Listbox selected count

  • Follow


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
Reply Utf 3/19/2010 5:51:02 PM

> 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
Reply 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
Reply 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
Reply Utf 3/23/2010 8:42:01 PM

3 Replies
2861 Views

(page loaded in 0.071 seconds)


Reply: