PC Review


Reply
Thread Tools Rate Thread

Refreshing/Clearing selections in a list box

 
 
TBernard
Guest
Posts: n/a
 
      24th Nov 2003
I have a from with two list boxes, the users can
select "highlight" records in the first list box and click
a button to add them to the 2nd list box. Everything is
working correctly, but I cannot get the highlighted
selecter to remove from the first list box.

So if the user selects one record and clicks "Add" to add
it to the 2nd list box, then decides they want to select
one more record, they must first unselect the highlighted
record (it automatically highlights the next record down
from the previous selected record once it is removed from
the first list box).

Here is the code I have tried, but has not worked:

lstMyListBox = Null

and

lstMyListBox = Empty

Neither seem to work, if anyone has any advice or any
ideas it would be greatly appreciated.

Thank you,

TBernard
 
Reply With Quote
 
 
 
 
John S
Guest
Posts: n/a
 
      24th Nov 2003
I'm not exactly sure what you are trying to do, but you have to set the
selected property to false, and cycle through the list:

Dim z As Integer
For z = 0 To lst.ListCount - 1 Step 1
lst.Selected(x) = False
Next z

VB has a method to clear a list box, and to clear items selected too, I
think, but VB Access does not.

John S
Aylmer, PQ


"TBernard" <(E-Mail Removed)> wrote in message
news:52f801c3b2ab$f3c23a50$(E-Mail Removed)...
> I have a from with two list boxes, the users can
> select "highlight" records in the first list box and click
> a button to add them to the 2nd list box. Everything is
> working correctly, but I cannot get the highlighted
> selecter to remove from the first list box.
>
> So if the user selects one record and clicks "Add" to add
> it to the 2nd list box, then decides they want to select
> one more record, they must first unselect the highlighted
> record (it automatically highlights the next record down
> from the previous selected record once it is removed from
> the first list box).
>
> Here is the code I have tried, but has not worked:
>
> lstMyListBox = Null
>
> and
>
> lstMyListBox = Empty
>
> Neither seem to work, if anyone has any advice or any
> ideas it would be greatly appreciated.
>
> Thank you,
>
> TBernard



 
Reply With Quote
 
 
 
 
John S
Guest
Posts: n/a
 
      24th Nov 2003
Damn thing didn't post -- trying again.

You have to use the selected property and cycle through the list box. The
code is thus:

Dim z As Integer
For z = 0 To lst.ListCount - 1 Step 1
lst.Selected(x) = False
Next z

John S.
Aylmer, PQ
"TBernard" <(E-Mail Removed)> wrote in message
news:52f801c3b2ab$f3c23a50$(E-Mail Removed)...
> I have a from with two list boxes, the users can
> select "highlight" records in the first list box and click
> a button to add them to the 2nd list box. Everything is
> working correctly, but I cannot get the highlighted
> selecter to remove from the first list box.
>
> So if the user selects one record and clicks "Add" to add
> it to the 2nd list box, then decides they want to select
> one more record, they must first unselect the highlighted
> record (it automatically highlights the next record down
> from the previous selected record once it is removed from
> the first list box).
>
> Here is the code I have tried, but has not worked:
>
> lstMyListBox = Null
>
> and
>
> lstMyListBox = Empty
>
> Neither seem to work, if anyone has any advice or any
> ideas it would be greatly appreciated.
>
> Thank you,
>
> TBernard



 
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
HOW do I make selections and carry only those selections thru proc kealaz Microsoft Access Database Table Design 5 5th Feb 2009 05:37 AM
HOW do I make selections and carry only those selections thru proc kealaz Microsoft Access 1 5th Feb 2009 03:35 AM
Start Menu selections and Graphical Button selections Pat Windows XP Performance 0 15th Jun 2004 05:52 PM
Multiple default printer selections, automatic selections? Eric Windows XP Print / Fax 0 30th Dec 2003 03:48 PM
display list box selections and use for combo box rdonges Microsoft Access Forms 0 15th Jul 2003 09:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:25 AM.