?
Solved

Find unselected listbox value

Posted on 2006-07-04
6
Medium Priority
?
690 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
[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
6 Comments
 
LVL 4

Expert Comment

by:Carl2002
ID: 17035651
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
ID: 17035654
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
ID: 17035725
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
What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

 
LVL 65

Accepted Solution

by:
rockiroads earned 500 total points
ID: 17035748
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
ID: 17035770
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
ID: 17035866
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

777 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