473,395 Members | 1,440 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,395 software developers and data experts.

Single selection in List Box



Ive a list box containing form names, and I want to return some property
details when an item on the list is selected
So far I've only been able to do this with the double click,
I wish to do this with only a single click, but when i do, I get an error

2480, ...............says the property is not in the collection.

Code below is for double click
This wont work for a single click

--------------------------------------------------
Private Sub List1_DblClick(Cancel As Integer)
On Error GoTo errroutine

Debug.Print Me.List1.Column(0, Me.List1.ItemsSelected(0))

Exit Sub

errroutine:
If err.Number = "3270" Then
Resume Next
Else
MsgBox err.Number & " " & err.Description
Exit Sub
End If

End Sub
-----------------------------------------------------
Any advice welcome.......
Gerry Abbott
Nov 12 '05 #1
2 3476
If the ListBox's MultiSelect property is set to None, then just use the
AfterUpdate event.
(Assuming you are trying to return the bound column)

If Me!List1.ItemsSelected.Count <> 0 Then Debug.Print Me.List1

Mike Storr
www.veraccess.com
"Gerry Abbott" <pl****@ask.ie> wrote in message
news:oZ***************@news.indigo.ie...


Ive a list box containing form names, and I want to return some property
details when an item on the list is selected
So far I've only been able to do this with the double click,
I wish to do this with only a single click, but when i do, I get an error

2480, ...............says the property is not in the collection.

Code below is for double click
This wont work for a single click

--------------------------------------------------
Private Sub List1_DblClick(Cancel As Integer)
On Error GoTo errroutine

Debug.Print Me.List1.Column(0, Me.List1.ItemsSelected(0))

Exit Sub

errroutine:
If err.Number = "3270" Then
Resume Next
Else
MsgBox err.Number & " " & err.Description
Exit Sub
End If

End Sub
-----------------------------------------------------
Any advice welcome.......
Gerry Abbott

Nov 12 '05 #2
Thanks Mike,
However I did try the code with the AfterUpdate event, and the scrolling of
records does return the correct values,
but simply clicking on the list does not.

The multiselect property is none and ive tried this with your suggested
code, and I get the same effect.

Any other suggestions welcome
BTW, its office97,
Have not tried it on 2000/XP yet.


"Mike Storr" <st******@sympatico.ca> wrote in message
news:a5********************@news20.bellglobal.com. ..
If the ListBox's MultiSelect property is set to None, then just use the
AfterUpdate event.
(Assuming you are trying to return the bound column)

If Me!List1.ItemsSelected.Count <> 0 Then Debug.Print Me.List1

Mike Storr
www.veraccess.com
"Gerry Abbott" <pl****@ask.ie> wrote in message
news:oZ***************@news.indigo.ie...


Ive a list box containing form names, and I want to return some property
details when an item on the list is selected
So far I've only been able to do this with the double click,
I wish to do this with only a single click, but when i do, I get an error
2480, ...............says the property is not in the collection.

Code below is for double click
This wont work for a single click

--------------------------------------------------
Private Sub List1_DblClick(Cancel As Integer)
On Error GoTo errroutine

Debug.Print Me.List1.Column(0, Me.List1.ItemsSelected(0))

Exit Sub

errroutine:
If err.Number = "3270" Then
Resume Next
Else
MsgBox err.Number & " " & err.Description
Exit Sub
End If

End Sub
-----------------------------------------------------
Any advice welcome.......
Gerry Abbott


Nov 12 '05 #3

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

Similar topics

5
by: Mark | last post by:
I have an application that uses PHP to access a MySQL table and extract rows which match the user's search entry. Data from the matching rows are loaded into an HTML selection list, and the user...
1
by: Jean Biver | last post by:
Dear readers: I found a web page with 2 selection lists in a form. The contents of the second selection list are updated based on the entry in the first selection list. For example: if the...
5
by: Jim Cobban | last post by:
I am trying to create a web page in which the contents of one selection list depends upon which element in another selection list is chosen, but where the information to populate the first...
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
5
by: srampally | last post by:
I need the capabilty to hide/show a selection list, just the way its done at http://www.lufthansa.com (place the cursor over "Group Companies"). However, I am looking for a javascript that is much...
3
by: ZaphodBBB | last post by:
Hi (Windows XP Pro, MS Access 2003) I have a form that has quite a number of list boxes on it. The list boxes only have 3 or 4 selections possible...Pass, Fail, Average, Not...
10
by: mukeshrasm | last post by:
Hi I have a html in which there is two selection box and two radio button. Radio buttion is of array type. What I want if user will click the radio button then only he/she be able to make...
7
by: robtyketto | last post by:
Greetings, I'm slowly building up code to do the following:- Display TWO selection option boxes (cascading). If the FIRST selection option box changes then reload the jsp using onchange...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.