[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Find unselected listbox value

Posted on 2006-07-04
6
Medium Priority
?
691 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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
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 Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
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…

650 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