472,975 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,975 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 3464
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.