Solved

ListBox Question

Posted on 1998-08-18
2
167 Views
Last Modified: 2010-04-30
I need to be able to read the value from a listbox that is only one line high.  I want the user to be able to click the up/down scroll bar (so it only shows one line of the listbox at a time), but not have to worry about actually clicking the item.  
The value must then be passed to another control to be written to a recordset.
What procedure or event do I use?  I have tried List1. Scroll but that doesn't seem to work.  As yet, I can only seem to get it to work once the user clicks the actual item.  This isn't suitable for my project.

Any ideas anyone???????????

Thanks...
   
0
Comment
Question by:nu2vb
2 Comments
 
LVL 6

Accepted Solution

by:
anthonyc earned 20 total points
ID: 1429521
put a listbox (list1) on a form, and run this code:

Option Explicit

Private Sub Form_Load()
    List1.AddItem List1.ListCount
    List1.AddItem List1.ListCount
    List1.AddItem List1.ListCount
    List1.AddItem List1.ListCount
    List1.AddItem List1.ListCount
    List1.AddItem List1.ListCount
   
End Sub

Private Sub List1_Scroll()
    List1.ListIndex = List1.TopIndex
End Sub


it works
0
 

Author Comment

by:nu2vb
ID: 1429522
Thanks Anthony.  I tried and just used List1.Text to check my response - Absolutely perfect!

Now I can proceed to the next problem!

Thanks again.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

707 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

18 Experts available now in Live!

Get 1:1 Help Now