" ' ' AS Fld5, ' ' AS Fld6, ' ' AS Fld7, ' ' AS Fld8"
But this if the number of records is 6:" ' ' AS Fld7, ' ' AS Fld8"
This is a section of the block of code:m.ix = 0 SCAN m.ix = m.ix + 1 lcFields = lcFields + IIF(m.ix > 1, ', ','') + ALLTRIM(FieldName) + ' AS Fld'+TRANSFORM(ix) ENDSCAN lnReportColumnCount = m.ix RunSQL = 'SELECT ' + lcFields + ' FROM ' + lcTable + ' ORDER BY ' + lcOrderField + ' INTO CURSOR ReportCursor' &RunSQL