Solved

Clear Highlight from Listbox Selection

Posted on 2007-03-28
13
1,376 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

724 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