By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,506 Members | 2,311 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,506 IT Pros & Developers. It's quick & easy.

list box double click

P: n/a
Access 2000: I'm showing a few rows in a list box and trap
double-clicks. how can I determin which row the user double clicked
on? Any help appreciated.
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ma*****@yellowmarker.co.uk (Matthew) wrote in message news:<51**************************@posting.google. com>...
Access 2000: I'm showing a few rows in a list box and trap
double-clicks. how can I determin which row the user double clicked
on? Any help appreciated.


You use the ItemsSelected collection of the listbox.

'******************** Code Start ************************
Dim frm As Form, ctl As Control
Dim varItem As Variant
Dim strSQL As String
Set frm = Form!frmMyForm
Set ctl = frm!lbMultiSelectListbox
strSQL = "Select * from Employees where [EmpID]="
'Assuming long [EmpID] is the bound field in lb
'enumerate selected items and
'concatenate to strSQL
For Each varItem In ctl.ItemsSelected
strSQL = strSQL & ctl.ItemData(varItem) & " OR [EmpID]="
Next varItem

'Trim the end of strSQL
strSQL=left$(strSQL,len(strSQL)-12))
'******************** Code end ************************

This is from www.mvps.org/access (so you know it works!) Basically,
you're iterating through the ItemsSelected collection and appending
the values to a string variable.

HTH
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.