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-----