473,379 Members | 1,201 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Getting the results from a list box

I've got a list box that has two columns. I would like to get the
value of the first column of the user selected row. How would I do
that? It is not a multiselect listbox.
PS Whats the difference between a "field list" and a "value list" in a
combobox?

Thanks in advance

Apr 20 '06 #1
4 1692
Karen Hill wrote:
I've got a list box that has two columns. I would like to get the
value of the first column of the user selected row. How would I do
that? It is not a multiselect listbox.


Me!ListBoxName.Column(0)

The columns are zero-based, so column 1 is index 0.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
Apr 20 '06 #2
Hi,

Thanks for the reply. It gets me the first column, but does it get me
the first column of the _user's_ selected row?

Apr 20 '06 #3
Karen Hill wrote:
Hi,

Thanks for the reply. It gets me the first column, but does it get me
the first column of the _user's_ selected row?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the ListBox is NOT multiselect then there can only be one item
selected. Which means that

Me!ListBoxName.Column(0)

refers to the item selected by the user.

Put the line in the ListBox's AfterUpdate event routine:

Private Sub ListBoxName_AfterUpdate()

MsgBox "Item selected: " & Me!ListBoxName.Column(0)

End Sub

If you're using a multi-select ListBox you'll have to designated which
item in the ItemsSelected collection you want:

dim varItm as Variant
set ctl = Me!ListBoxName
with ctl
For Each varItm In .ItemsSelected
Debug.Print .Column(0, varItm)
Next varItm
end with

This routine prints the value of the 1st column in the ListBox, for all
selected items of a multi-select ListBox.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBREft/IechKqOuFEgEQI5ygCfRtVLVuiIvez73yv24w1GjKkrYaMAoOM N
k3vGTl7MGz1PV16jJynunReD
=TBp2
-----END PGP SIGNATURE-----
Apr 20 '06 #4
Say your listbox has the following... (2 columns)
ItemIDNo ItemText
1 Apple
2 Orange
3 Banana

If you want to return the *text*, (instead of the ItemIDNo), you need
to use

Me!ListBoxName.Column(1)

ItemIDNo is column number zero.
ItemText is column number one.

Hope that clarifies things.

Pieter

Apr 20 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steve | last post by:
I'm working in PHP, but am also using JavaScript, so perhaps there is a better way to do this using more PHP code...... I setup a search screen for my database, the user enters data and submits...
17
by: John Hunter | last post by:
I have a largish data set (1000 observations x 100 floating point variables), and some of the of the data are missing. I want to try a variety of clustering, neural network, etc, algorithms on the...
303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
0
by: Rodrigo Daunaravicius | last post by:
I'm having trouble understanding hotshot's results. It's the first time I use a profiler. I'm trying to profile a loop that takes almost six hours (~21000 seconds) to execute in production. The...
2
by: Mark | last post by:
Hi Guys, I have a page with a list of links that when clicked submit data to a clients search engine, The result opens in another window and either displays a list of items or diaplays "No Items...
4
by: s99999999s2003 | last post by:
hi the database "execute" function returns a list of logical results. Each logical result is a list of row tuples, as explained in the documents. everytime i use it to execute various...
6
by: Marc | last post by:
This is probably a no brainer for the most of you but my head is spinning at the moment. Considering the following list how do I get a reference to the ul just below the li with id products?...
1
by: dallasfreeman | last post by:
I'm looking at a quick way to get results that are displayed as rows to display as columns. I have three tables:- - The Questions for the survey - The Results of the survey (Columns are listed...
25
by: altemurbugra | last post by:
Hi is it possible to make search on for example on google without api with a list of words 1- there is word list 2- the script will take the words from the list by turn 3-it iwll make the search...
1
by: lawton | last post by:
Source: this is an access 2003 question My knowledge level: reading books, internet, and trial & error; no formal training I'm trying to get a running sum of what's filtered in a subform which is...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.