>>>I tried your solution and this is what I found,
>>>
>>>Foxpro still has to substitute the macro stuff and when it does, it gets a command that is too long. I don't think it matters how many macros you use, FoxPro still has to evaluate the information, and when it does, You will get the same error message.
>>>
>>>Unless I am missing something.
>>>
>>>Jeremy Weidig
>>
>>AFAIK, multiple macros should cure this problem. If for some magic reason it doesn't work you still have options to go around like dissecting one SELECT to chain of SELECT(s) or dropping off unnecessary joints.
>
>Multiple macros won't help here - FoxPro substitutes in for the macros, and then the resulting command is executed. The resulting command in this case exceeds the limit for the length of an SQL statement. You could do it with one macro or ten, you still end up with the same SQL statement just prior to execution.
It depends what limit is exceeded: SQL-string or compilation string. Anyway, as I said, there are some workarounds.
Edward Pikman
Independent Consultant