Solved

Find unselected listbox value

Posted on 2006-07-04
6
641 Views
Last Modified: 2008-02-01
Hi,

I am trying to automatically get the value of an unselected and unbound listbox in my form. I need to get this value to determine what happens next in my code. My listbox is called RatingFind.

I have also tried to change my listbox to a combo box to try to get the value from this, but I can't figure out how to select this value either!

Can anyone suggest any code that I can use to get this value from my listbox?

Thanks in advance,
Susan
0
Comment
Question by:Susan2c
6 Comments
 
LVL 4

Expert Comment

by:Carl2002
Comment Utility
Do you mean you want the values of anything unselected from the listbox?
ir if the list box contains 1,2,3,4,5 and 4 is selected you want to return 1,2,3 and 5?

Carl.
0
 
LVL 77

Expert Comment

by:peter57r
Comment Utility
Hi Susan2c,
If nothing is selected in the list box then it will be null.

Otherwise if the code is in the form's module you would use something like:

if me.ratingfind = somevalue then

The value of a single-select list box, or a combo box is the value in the bound column of the row selected.  The bound column might not be the value that is displayed to the user.

Pete
0
 

Author Comment

by:Susan2c
Comment Utility
The list box is unbound and it will only contain one value, if it has a value in it. The value will either be 1 or null. I don't want the user to have to select a list box for no reason, so I want to read it unselected. I know there is some code to do this, and I have tried to use the following, but it will only return null so far!

Me!RatingFind.Selected(1) = True
vartest8 = Me.RatingFind.Value
MsgBox vartest8

Thanks,
Susan
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 65

Accepted Solution

by:
rockiroads earned 125 total points
Comment Utility
U can use ListCount

if Me.RatingFind.ListCount = 0 then
    msgbox "No Items"
else
    msgbox "First Item = " & Me.RatingFind.Column(0, 0)
end if
0
 
LVL 77

Expert Comment

by:peter57r
Comment Utility
So are you saying that if it is null you will treat it as if it is 1?
If so, why are you testing it - and moreover, why does it exist at all?

Pete
0
 

Author Comment

by:Susan2c
Comment Utility
Thanks rockiroads, that has worked.

Pete, there is either a value of 1, or it is null, and I wanted to test if there was a value there.

Thanks again,
Susan
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

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…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server functions 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 Microsoft Ac…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

762 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

9 Experts available now in Live!

Get 1:1 Help Now