List box multi-choices

  • Thread starter Thread starter Lee Harwell
  • Start date Start date
L

Lee Harwell

I need code for making my listbox multiple choices from a
Search form open up in another (Detail) form. I have not
been able to find any examples on how to do this. Can you
provide me with some.
Thanks, Lee
 
-----Original Message-----
I need code for making my listbox multiple choices from a
Search form open up in another (Detail) form. I have not
been able to find any examples on how to do this. Can you
provide me with some.
Thanks, Lee
.
Hi Lee, I am not clear about what you mean by 'listbox
multiple choices'. Do you mean that you each item in the
list represents a record that you want filter for so that
when a users navigates from one record to the next in the
opened form, they can only move to the records selected in
the list.

If 'yes' one way to acheive this is as follows...

***** code starts ******

dim strListID as string
dim varItem as variant

with lstListBox
For Each varItm In .ItemsSelected
strListID =strListID & .ItemData(varItm) & ","
Next varItm
end with

if len(strListID)>0 then
' remove extra comma and create where condition
strListID = "[RecordID] In(left(strListID,len(strListID)-
1))
end if

docmd.openform
FormName:="myForm",WhereCondition:=strListID

****** code ends *****

Luck
Jonathan
 
Back
Top