List Box Question?

  • Thread starter Thread starter TC
  • Start date Start date
T

TC

1- How Do I know the number of item is list box?
form example
Listbox1
a
b
c
d
e
I want to know the number of item in the listbox1 in (this example is 5)

Isn't there a ListCount property? (I don't have Access here to check.)

2- How do I know is there any row (data) in the listbox?

ListCount > 0 ?

3- How Can I select all item in a list box using command button?

I imagine you would need to set the MultiSelect property of the listbox to
True, then set the Selected property of each Item in the list. Check out
Selected in online help.

HTH,
TC
 
1- How Do I know the number of item is list box?
form example
Listbox1
a
b
c
d
e
I want to know the number of item in the listbox1 in (this example is 5)
2- How do I know is there any row (data) in the listbox?
3- How Can I select all item in a list box using command button?
Thank you
 
Thank you for your help
2- How do I know is there any row (data) in the listbox?
ListCount > 0 ?
if me.listbox1.listcount>0 then
msgbox "No Data"
end if
The previous code give this message when there is data and where is no data
============
3- How Can I select all item in a list box using command button?
I don't find useful information about selected in access online help
 
1aae said:
Thank you for your help
2- How do I know is there any row (data) in the listbox?
ListCount > 0 ?
if me.listbox1.listcount>0 then
msgbox "No Data"
end if
The previous code give this message when there is data and where is no
data

The message box will be (or should be) displayed when there is data.
Although it does give a misleading message :-)
Warning: Setting column heads to Yes changes the list count as it adds
another record to the listcount property.

============
3- How Can I select all item in a list box using command button?
I don't find useful information about selected in access online help

Dim lngCount As Long

For lngCount = 1 To Me.Listbox1.ListCount
Me.Listbox1.Selected(lngCount - 1) = False
Next
 
Not sure why ListCount>0 wouldn't work. I checked it last night (on a PC
that did have Access) & it was certainly noted in online help as a valid
listbox property.

By "no data" in the listbox, do you mean that the listbox has no rows
displayed, or it >does< have rows displayed but you have not clicked any
yet?

Cheers,
TC
 
Back
Top