A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to clear listbox selection



 
 
Thread Tools Display Modes
  #1  
Old July 10th, 2004, 12:17 PM
Rob Rutherford
external usenet poster
 
Posts: n/a
Default How to clear listbox selection

Win XP, Access 2002. I'm trying to solve a problem with a single column listbox that displays selected values from a table whenever
its RowSource is changed in code. If I select an item so that it is highlighted, then invoke the code to change the RowSource, the
box is refilled with no item highlighted. However, if the RowSource is then changed back to what it was when I selected the item,
this same item is still highlighted. I'd like to stop this behaviour. Each time the box is repopulated I want nothing to appear
selected. Any advice would be appreciated.


  #2  
Old July 10th, 2004, 01:53 PM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default How to clear listbox selection

"Rob Rutherford" wrote in message

Win XP, Access 2002. I'm trying to solve a problem with a single
column listbox that displays selected values from a table whenever
its RowSource is changed in code. If I select an item so that it is
highlighted, then invoke the code to change the RowSource, the box is
refilled with no item highlighted. However, if the RowSource is then
changed back to what it was when I selected the item, this same item
is still highlighted. I'd like to stop this behaviour. Each time the
box is repopulated I want nothing to appear selected. Any advice
would be appreciated.


If this is not a multi-select list box, try setting the list box's value
to Null when you change its rouwsource; e.g.,

With Me.MyListbox
.Value = Null
.RowSource = whatever
End With

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


  #3  
Old July 10th, 2004, 05:45 PM
Rob Rutherford
external usenet poster
 
Posts: n/a
Default How to clear listbox selection

Many thanks Dirk, it works a treat.


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying listbox selection in textbox steve411 General Discussion 1 June 19th, 2004 07:21 PM
Combo Box selection disappearing on new record and change of option selection EmmA Using Forms 2 June 17th, 2004 02:21 AM
Hide Specific rows. Steve Worksheet Functions 7 June 9th, 2004 09:27 PM
word text selection [email protected] General Discussion 3 May 30th, 2004 10:35 AM
Clear checkboxes Jaime Andersen Worksheet Functions 1 December 30th, 2003 07:29 PM


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.