** lcRecordsource is the recordsource of the grid Select (lcRecordSource) Afields(aFlds,lcRecordSource) For ix = 1 To This.Parent.grd1.ColumnCount lcIx = '"FLD'+Alltrim(Str(ix))+'"' lcField = Alltrim(aFlds(ix,1)) Index On &lcField Tag &lcIx Additive Endforthen in the click event of the header for each column in the grid i have the following
lcColIndex ='FLD'+ Alltrim(Str(This.Parent.ColumnOrder)) lcRecordSource = This.Parent.Parent.RecordSource Select (lcRecordSource) Set Order To &lcColIndex In &lcRecordSource Go Top This.Parent.Parent.RefreshCurrently I am coping and pasting this code in each header click of the grid.