Solved

Clear Highlight from Listbox Selection

Posted on 2007-03-28
13
1,300 Views
Last Modified: 2013-11-28
Hi There,
Product: MS ACCESS 2000
Process: FORM (CREATION)
Function: LISTBOX (CREATION)
Problem: MANAGING  VALUE "HIGHLIGHTING"
I am creating a form from scratch.
The first field is a listbox, lblCDTYPEREF, which selects a value from the underlying Table tblCDDESCR.
The result correctly displays the list of options from the Table.
When I click to select an item from the list the value is highlighted.
However, when I tab across to the next field the highlight remains on the listbox; it does not change.
What do I need to do (assumingly withing the listbox properties, AfterUpdate)  to remove the highlight once I tab across from the listbox field? Or is the field requiring a corresonding table field to apply the selection to?
(I'm creating this dummy form as a step to building the form slowly but surely.
Thanks very much.
djvbWarrior (Access Novice)
0
Comment
Question by:djvbwarrior
  • 4
  • 3
  • 2
  • +1
13 Comments
 
LVL 5

Expert Comment

by:Atropa
ID: 18820602
ListBox1.Selected = ""

That should do the trick I hope.  let me know if it does not...a
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18821398
How about in the after update event, you do something like so

With Me.MyListBox
    For I = 0 To .ListCount - 1
        .Selected(I) = False
    Next I
End With
0
 

Author Comment

by:djvbwarrior
ID: 18842398
Hi again,
With Jeffwilley's  suggestion:
With Me.MyListBox
    For I = 0 To .ListCount - 1
        .Selected(I) = False
    Next I
End With
This does not appear to have made a difference. I can make a selection, but the highlight remains when I tab to another field.

With Atropa's suggestion, the coding may require further clarification. Should it appear in the AfterUpdate property of the Listbox?
I have tried using it there, VB flags up an selected(IROW as Long) value requested.
Im confused now.
Thanks
Djvbwarrior
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 34

Expert Comment

by:jefftwilley
ID: 18842467
can you take a moment and paste in the event code you're using please?
J
0
 

Author Comment

by:djvbwarrior
ID: 18843809
Hi there jefftwilley:
Currently it looks like this, based on  what's been suggested earlier.
Apologies if I'd taken the earlier comments too literally:
Private Sub lboCDTYPEREF_AfterUpdate()
With Me.lboCDTYPEREF
    For I = 0 To .ListCount - 1
        lboCDTYPEREF.Selected(I) = False
    Next I
End With
Context:
The listbox lboCDTYPEREF displays a list of values contained in the table tblMUSICTYPE. The list is being displayed.
What I want to have happen is to select a value from lboCDTYPEREF and have that  populate a corresponding field in a subsequent table.
At the moment I can make a selection, and the selection is highlighted.
When I tab across the value remains highlighted.
I want the value from this field (i.e. lboCDTYPEREF ) to update a subsequent table and then when i tab from the box, for the highlighting to disappear and the list to return to the first value.
Trust this makes sense.
Should you need further clarification on table structure, etc please let me know.
Thanks
djvbwarrior
0
 
LVL 34

Accepted Solution

by:
jefftwilley earned 50 total points
ID: 18843912
Private Sub lboCDTYPEREF_AfterUpdate()
dim I as long
With Me.lboCDTYPEREF
    For I = 0 To .ListCount - 1
        .Selected(I) = False
    Next I
End With
end sub
0
 
LVL 5

Assisted Solution

by:Atropa
Atropa earned 50 total points
ID: 18844018
Put it in OnLostFocus
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18844103
It shouldn't have to be put on Lost focus, because the only time anything will get highlighted is when it's "updated".
After Update should work fine.
J
0
 

Author Comment

by:djvbwarrior
ID: 18856197
Hi there,
Thanks for these updates.
I will apply and feed back as soon as possible.
DJ
0
 
LVL 61

Expert Comment

by:mbizup
ID: 19015047
The code works fine... however it does need to be in the lost focus (or some other) event.  In the AfterUpdate event, it will deselect the user's selections immediately, so the user never actually sees the selections highlighted.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question