Ken,
From my testing the grid.RecordSource length at runtime seems to be limited to 259 characters. But seriously there is absolutely no need to use such a huge SQL statement in the grid property. Build your SQL string however big you want it, put the result in a cursor and set the grid.RecordSource=cursorname, RecordSourceType = Alias. Yves' code will work just fine there is no 254 character limit on the total length of a string. An individual string constant, everything enclosed by a set of ", is limited to 254 characters.
>>Here's the workaround
>>instead of
>> THISFORM.grd.recordsource = m.tsql1 + m.tsql2 + m.tsqlx + m.twhere + m.torder + m.tinto
>>
>>create the cursor by executing the SQL select
>>* create you commend line as a string
>>lcSql = m.tsql1 + m.tsql2 + m.tsqlx + m.twhere + m.torder + m.tinto
>>* then execute the command.
>>&lcSql
>>set the THISFORM.grd.recordsource to the cursor name you just created.
>>And maybe have the column properties reinitialised if needed.
>
>Don't think that will work, because lcSql will be a string that exceeds 254 character :( But thanks for the thought!