SELECT company.company,company.address FROM ; company WHERE company.cidcomp in ; (SELECT DISTINCT Company.cidcomp FROM company INNER JOIN ; kent!compdesc ON Company.cidcomp = Compdesc.cidcomp INNER JOIN ; kent!descrips ON Compdesc.ciddesc = Descrips.ciddesc INNER JOIN ; kent!sectorline ON Descrips.naics = Sectorline.naics INNER JOIN ; kent!sector ON Sectorline.cidsect = Sector.cidsect WHERE ; Sector.sector = ( 'Manufacturing' )) ORDER BY company.companyNow, I need to be able to dynamically place this code into the RecordSource property of a control on my form, but I keep getting an error that "Command contains unrecoginized phrase/keyword." The code I am using is as follows (in the LostFocus event of a ComboBox on the form)
thisform.olecontrol1.recordsource =" SELECT company.company,company.address FROM ; company WHERE company.cidcomp in ; (SELECT DISTINCT Company.cidcomp FROM company INNER JOIN ; kent!compdesc ON Company.cidcomp = Compdesc.cidcomp INNER JOIN ; kent!descrips ON Compdesc.ciddesc = Descrips.ciddesc INNER JOIN ; kent!sectorline ON Descrips.naics = Sectorline.naics INNER JOIN ; kent!sector ON Sectorline.cidsect = Sector.cidsect WHERE ; Sector.sector = ( 'Manufacturing' )) ORDER BY company.company"Can anybody explain to me what I am doing wrong, and how I might be able to get this working as I intend?