Solved

Clear Highlight from Listbox Selection

Posted on 2007-03-28
13
1,275 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
Comment Utility
ListBox1.Selected = ""

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

Expert Comment

by:jefftwilley
Comment Utility
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
Comment Utility
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
 
LVL 34

Expert Comment

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

Author Comment

by:djvbwarrior
Comment Utility
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
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 34

Accepted Solution

by:
jefftwilley earned 50 total points
Comment Utility
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
Comment Utility
Put it in OnLostFocus
0
 
LVL 34

Expert Comment

by:jefftwilley
Comment Utility
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
Comment Utility
Hi there,
Thanks for these updates.
I will apply and feed back as soon as possible.
DJ
0
 
LVL 61

Expert Comment

by:mbizup
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
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…
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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now