PC Review


Reply
Thread Tools Rate Thread

Clear a listbox

 
 
Erwin Bormans
Guest
Posts: n/a
 
      9th Jan 2008
Hi all

In my Acces project I got multiple listboxes.

Is there an easy way to clear the listbox if you click a button.

I tried Me.lstBox.Clear / Clear Me.lstBox but it doesn't work.

Kind regards
Erwin
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      9th Jan 2008
How you do

Dim varSelected As Variant

For Each varSelected in Me.ListboxName.ItemsSelected
Me.ListboxName.Selected(varSelected) = False
Next varSelected


Alternatively, if the Multiselect property is None (0) or Extended (2), you
can clear all selected entries strictly by setting the list box to Null. If
the Multiselect property is Simple (1) or Extended (2), you can clear all
selected entries by resetting the RowSource property:

Select Case Me.lstEmployees.MultiSelect
Case 0 ' None
Me.lstEmployees = Null
Case 1 ' Simple
Me.lstEmployees.RowSource = Me.lstEmployees.RowSource
Case 2 ' Extended
Me.lstEmployees = Null
Me.lstEmployees.RowSource = Me.lstEmployees.RowSource
End Select


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Erwin Bormans" <erwin.bormans@verwijderdit_telenet.be> wrote in message
news:(E-Mail Removed)...
> Hi all
>
> In my Acces project I got multiple listboxes.
>
> Is there an easy way to clear the listbox if you click a button.
>
> I tried Me.lstBox.Clear / Clear Me.lstBox but it doesn't work.
>
> Kind regards
> Erwin



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clear Method not working for a ListBox clear scott56hannah Microsoft Excel Programming 4 14th Feb 2008 09:42 PM
Re: dataset.clear doesn't clear listbox Val Mazur Microsoft ADO .NET 2 11th Nov 2004 04:12 AM
Moving listbox item from listbox to listbox Kevin Quigley Microsoft Dot NET 2 2nd Jun 2004 11:34 AM
clear history, not "Clear History" or "Clear Forms" or TypedURLS Nick Windows XP Internet Explorer 4 31st Mar 2004 05:22 AM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Microsoft Excel Programming 0 22nd Oct 2003 12:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:04 PM.