>Hi
>
>I have a form with a list box which has several values i.e. T1, T2, T3 ..........T7. This list box is not connected to any table. The values are added manually. I have a table from a database application which has thousands of records. One of those fields is called department and contained within the field are the values T1 or T2 or T7 etc.
>
>What I would like to do is to use the list box on my form (multiple select) and then click a button to find those records that match what I have selected in the list box. For example if I select T2 and T7 then it would list those records that have T2 and T7 in the department field. I suppose I need some looping statement to do this. Can anybody start me down the right path.
>
>Thankyou very much!
create cursor temp (department c(fsize('department','searchtable')))
with .ListboxName
for ix=1 to .Listcount
if .Selected[ix]
insert into temp values (.List(ix) )
endif
endfor
select * from SearchTable ;
inner join temp on SearchTable.Department = temp.Department ;
into cursor crsMatch
You might do that w/o a temp cursor too but w/o knowing how many items migh be selected max, this is better IMHO.
Cetin