Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 7th, 2007, 01:20 PM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unhighlight Listbox Items

I have a listbox that the user makes a selection from. Based on that selection I fill in some hidden text boxes to gather the necessary data I need to send to a query that inserts records into my database. After the query has run I update the row source of the listbox to display the remaining list items. (the item the user selected is now gone from the listbox.) After the above process is done I would like to be able to unhighlight any item in the listbox because my process is dependent on the user selecting an item from the box. If the next record in the listbox remains highlighted the user thinks that it is selected. I have tried using the .selected(listitem) = false solution but it does not appear to work. The research I have done says this is the way to go but I am wondering if by updating the row source of the listbox and then requerying is causing some problems. I have also tried to set the selected property of the list item to false before updating the row source to no avail. Here is a snapshot of the code, I appreciate any assistance on this.

intIndex = Me.lstAssistRequests.ListIndex

<do stuff>

strSQLRowSource = "SELECT....."

Me.lstAssistRequests.RowSource = strSQLRowSource

Me.lstAssistRequests.Requery

Me.lstAssistRequests.Selected(intIndex ) = False ' this portion doesnt seem to work properly


The requery portion works perfectly, the item selected from the listbox is removed. The problem lies in after the item is removed the next item in the listbox is highlighted. I want it be unhighlighted so the user needs to explicity select the next item from the list box.

Matt

 
Old March 7th, 2007, 01:39 PM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nevermind, the solution was too easy, I was making it more complex than it needed to be. Me.lstAssistRequests.Value = "" forces the user to select again and unhighlights all items in the listbox.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting all listbox items Lucy_H85 C# 2005 2 December 1st, 2009 05:36 AM
unselecting items in a listbox Durkee VB.NET 2002/2003 Basics 9 October 8th, 2007 03:01 PM
Moving Items up and down in a listbox Brendan Bartley Access 15 September 18th, 2007 06:42 AM
UNSelect Items in ListBox mmcdonal Access VBA 7 June 21st, 2007 08:09 AM
Saving Listbox Items antonducabre VB.NET 2002/2003 Basics 1 July 16th, 2003 12:46 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.