473,508 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Number of items selected

Hi

Is there a way to get the count of selected items in a list?

Thanks

Regards
Nov 13 '05 #1
2 4290
John wrote:
Hi

Is there a way to get the count of selected items in a list?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

What type of list? A ListBox; a query result?

In a ListBox you can use the .ListCount property of the List Box:

intCount = Me!lstCandies.ListCount

If you're using an Extended ListBox you can get the number of items
selected by using the ItemsSelected.Count:

If Me!lstCandies.ItemsSelected.Count > 2 Then
MsgBox "Now, now! Only 2 candies for each of you", vbExclamation
End If

In a query use the Count(*) function:

SELECT Count(*) AS ItemCount
FROM table_name
WHERE <criteria>

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQbTY7YechKqOuFEgEQIWCQCfTChwV/g0GH5+ctolcgLLmmKALToAoM5S
M3bLgRofr08XrCrfz8UGLnHH
=oSBz
-----END PGP SIGNATURE-----
Nov 13 '05 #2
John wrote:
Hi

Is there a way to get the count of selected items in a list?


Why, yes, yourListbox.ItemsSelected.Count

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
26315
by: Georges Heinesch | last post by:
Hi. I have a combobox with a value list of 4 items. My code needs to know the number of items in that combobox. How can I use VBA to get the number of items in a combobox? TIA --
7
24090
by: GTi | last post by:
I have a listview that with selected items. But I want to "reselect" items after a refresh. Each items have a uniqe value in the Tag object. After a refresh some new items may be added or removed...
2
3476
by: Rey | last post by:
Howdy all. This may have been covered previously but I've had no success in retrieving it... Where may I find what the limitations are of the various controls, i.e. number of records/items that...
10
3270
by: Adam Clauss | last post by:
I have a page containing a list box. This list may contain duplicate items - in which the ORDER is important. ex: a b b a is significant as compared to: b
21
5170
by: StriderBob | last post by:
Situation : FormX is mdi child form containing 2 ListViews ListView1 contains a list of table names and 4 sub items with data about each table. ListView2 contains a list of the columns on each...
4
6981
by: Jonathan | last post by:
Hi, I have a listview with many rows init. The first column is "No." which shows the row number in the listview. When a user selected a row and delete it, say row 3. I want to organise the...
0
7525
by: Brian Henry | last post by:
Since no one else knew how to do this I sat here all morning experimenting with this and this is what I came up with... Its an example of how to get a list of items back from a virtual mode list...
2
2747
by: John | last post by:
I have a listbox that is databound when my form loads. A user can then select and option using a drop down box. When the user selects an option the corresponding items in the listbox gets selected....
0
1357
by: hennas | last post by:
Basically i want to design a membership Name and Telephone List form using the following command buttons. Edit Add New; Update; Delete; Cancel; Save; Clear, and Exit
0
7229
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7129
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7398
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3194
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
428
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.