>I do a SELECT on my primary table and try to match coded fields from my primary table to code translate tables. For example, if I find code for aed_info.aedloc = "OT", I look in the lookloc table for lookloc.lookcode = "OT" and then I take lookloc.lookdesc which is "OTHER" and put that description in my report. But I keep getting the error SQL command "Lookcode" is not found or something like that. Prior to putting the path in for lookloc, I was getting an OPEN table window because the SELECT could not find the table. Any ideas? Is this how you do a multiple join condition? I have never done one. And I have 6 fields in my primary table that need translating of codes in to words of text. So I built 6 separate lookup tables, one for each field that needs translating. And I want to translate all 6 codes in each primary table record for my report. I am going in circles at this point. I don't see what's wrong. Please help thanks. Here is my code:
>
>
>IF THISFORM.cborpt.Value = "23"
> SELECT aed_info.* FROM aed_info LEFT JOIN \data\aed\lookloc ON ALLT(aed_info.aedloc) = ALLT(lookloc.lookcode) ;
> LEFT JOIN \data\aed\lookhrs ON ALLT(aed_info.hrs) = ALLT(lookhrs.lookcode) ;
> LEFT JOIN \data\aed\lookpage ON ALLT(aed_info.emspager) = ALLT(lookpage.lookcode) ;
> LEFT JOIN \data\aed\lookcaut ON ALLT(aed_info.aed_cautn) = ALLT(lookcaut.lookcode) ;
> LEFT JOIN \data\aed\looktrn ON ALLT(aed_info.trainedby) = ALLT(looktrn.lookcode) ;
> LEFT JOIN \data\aed\lookwho ON ALLT(aed_info.whowants) = ALLT(lookwho.lookcode) ;
> ORDER BY aed_info.city, aed_info.unitid ;
> INTO CURSOR rpt
> IF THISFORM.cboOutputTo.Value = "S"
> REPORT FORM \arrest\reports\aedlocdt.frx PREVIEW IN SCREEN
> ELSE
> REPORT FORM \arrest\reports\aedlocdt.frx TO PRINT
> ENDIF
>ENDIF
>
Steve,
It's hard to follow long SQL lines :) At first glance it sounds that VFPs optimizing joins is the problem. With these type of queries I would try adding a "FORCE" clause after " FROM ".
Cetin