Jim, CHOOSE vbuildcode FROM #VALUES FOR building_name, building_id + FROM building + ORDER BY building_name LINES 25
select building_name into vBName from building + WHERE building_code=.vbuildcode CHOOSE vdeptcode FROM #VALUES + FOR DISTINCT (department_code & .vBName), department_code + FROM main + WHERE building_code=.vbuildcode --ORDER BY department_code you don't need the order by because the distinct will do that already Dennis McGrath

