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