USE header IN 0 USE lineitem IN 0 AGAIN ORDER idTag USE lineitem IN 0 AGAIN ALIAS FirstRec ORDER idTag SELECT header SET RELATION TO idField INTO lineitem, idField INTO FirstRec SET SKIP TO lineitemThe key is SET SKIP which makes VFP think that the header table has as many records as the line item tables. When you (or the report writer) skip through the table, the record pointer moves through all line item records. Only if there is no related line item SKIP will actually move the record in the parent table. Because SET SKIP is not set to the FirstRec table, VFP always locates the first line item for every header record.
RECNO("lineitem") == RECNO("FirstRec")This condition is only true for the first line item record which happens to be the time when you need to print the simulated group header. The second line is the actual detail line. No special settings for the second line are required. Just make sure that the first and the second line to not overlap or share any common objects such as vertical lines.