>>WITH THIS >> lsCurrentRow = curDisplay.UniqueID >> >> ZAP IN curDisplay >> >>&& .SortOrder / .sortdirection are properties of the grid that contain field being sorted. >>&& lsAccount and lsRecordType are assigned just previous to this code. >> >> lsSQL = "INSERT INTO curDisplay " +; >> "SELECT curWorking.UniqueID, curWorking.IsSelected, " +; >> "curWorking.Invert, curWorking.IsRestricted, " +; >> "!ISNULL(curWorking.Annotation) as HasNote," +; >> "curWorking.ClearDate, curRecon.SWDN, curRecon.PrimaryDoc, " +; >> "curRecon.CAAmount, curRecon.DAAmount, curRecon.AuditDate, " +; >> "curRecon.MachineDate, curRecon.SecondaryDoc, curRecon.Site, " +; >> "curRecon.Source, curRecon.GLC, curRecon.ReconMonth, " +; >> "curRecon.TransactionType, curRecon.LastRFA " +; >> "FROM curWorking WITH (BUFFERING = .T.) " +; >> "INNER JOIN curRecon ON curWorking.UniqueID = curRecon.UniqueID " +; >> "WHERE ISNULL(curWorking.MatchedTo) AND " +; >> "curRecon.RecordType = '" + lsRecordType + "' AND " +; >> "ALLTRIM(curRecon.Account + NVL(curRecon.CFI,'')) == '" + lsAccount + "' "+; >> IIF(THIS.Parent.chkDisplayCleared.Value, "" ,; >> "AND ISNULL(curWorking.ClearDate) ") +; >> "ORDER BY " + .SortOrder + " " + .SortDirection >> >> &lsSQL. >> >>&& Keeps the same record highlighted as before the sort >> SELECT curDisplay >> GO TOP IN curDisplay >> LOCATE ALL FOR curDisplay.UniqueID = lsCurrentRow >> >> IF FOUND('curDisplay') >> GO RECORD (RECNO('curDisplay')) >> >> ELSE >> GO TOP IN curDisplay >> >> ENDIF >> >> .Refresh() >> >> .AutoFit() >> .Resize() >> >>ENDWITH && THIS >>>>