CREATE CURSOR crsList ( siccode2 C(nnn) ) >FOR i = 1 TO THISForm.list3.ListCount > INSERT INTO crsList VALUES ( alltrim((THISform.list3.List(i)))) >ENDFOR > >SELECT agbrands.brandname, agclients.clientname, ; > alltrim(Agind.prefix) As prefix, alltrim(Agind.fname) As Firstname, ; > alltrim(Agind.initial) as Initial, alltrim(Agind.sname) as Surname, ; > alltrim(Agind.position) as position, Agind.phone as phone, ; > Agind.fax as fax, Agind.email as email, ; > agencies.agname as Agencyname, IIF(agencies.mediaco = .T.,'M','A'), ; > agencies.agadd1 as Address1, agencies.agadd2 as Address2, ; > agencies.agadd3 as Address3, agencies.agadd4 as Address4, ; > alltrim(agencies.county) As county, alltrim(postcode) as postcode ; > FROM agencies ; > INNER JOIN Agind ON agencies.agencyid = Agind.agencyid ; > INNER JOIN indvcl ON Agind.agindid = indvcl.agindid ; > INNER JOIN agbrands ON agbrands.brandid = indvcl.brandid ; > INNER JOIN agclients ON agbrands.clientid = agclients.clientid ; > WHERE Agbrands.siccode2 IN ( ; > SELECT siccode2 FROM crsList ) ; > INTO CURSOR temp >I would also recomend to remove all ALLTRIM() functions from your select because they could cause unexpected field truncation. They also useless because the size of the fields in VFP table/cursor is fixed.