Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 June 12th, 2007, 07:34 AM
Registered User
Join Date: Jun 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Listbox Controls

I created a db.
In access I created a form also.
This form contains a listbox wich contains (a part of) al db records.
With a textbox and VB I creates a realtime search in the db.
After every character given in the textbox the listbox contains only the recors who contains the search patron.

Sofar it works realy cool.

However when I click on the listbox I select the row I click on and that's also as I want.
I want that when I leave (or lost focus on) the listbox, this selection will be deselected (and the selection mark will despare.

Someone told me that list.selected(list.listindex)=false must do the job.
Howerver I see the value of list.selected(list.listindex) and that is 0 and stays 0.
The give command must set it to -1. Wich is the value of al the other items of the listbox.

Can someone help my out?

Old July 17th, 2007, 10:53 AM
Registered User
Join Date: Jul 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

Perhaps you could create an event that will refresh the listbox when it loses focus?

Something like this:

Private Sub "YOUR LISTBOX NAME"_LostFocus()
End Sub


Private Sub "YOUR LISTBOX NAME"_LostFocus()
End Sub

Have you tried this yet?

Old July 17th, 2007, 11:02 AM
Friend of Wrox
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post

hi toospeter,

The List.Selected... method only works with Checkbox Lists - From what you are saying, you are using a standard
ListBox yes?

If so, try (Shane was on the right track)
Private Sub List_LostFocus()
    List.Value = Null
End Sub
Hope this helps.

<center>"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".

Thomas Jefferson</center>

Similar Threads
Thread Thread Starter Forum Replies Last Post
ListBox belete ASP.NET 2.0 Basics 2 October 19th, 2007 04:46 AM
User controls' content: Chapter 2 User Controls AGS BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 10 July 26th, 2007 05:36 AM
multiple Listbox values in another listbox terryv Excel VBA 0 June 27th, 2007 07:01 AM
About listbox csc820203 C# 2 May 1st, 2004 01:32 AM
I'm back :) Listbox var from listbox MichaelTJ .NET Web Services 2 October 21st, 2003 07:06 PM

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