>with thisform.grdQuestions > .recordsource="select question, rank, tkey, qkey from qtable " + ; > "into cursor questions order by rank" + ; > " where tkey = '" + lcTkey + "'" > .refresh() > .setfocus() >endwith >>
*Form.init create cursor questions (Rank i,Question c(30)) insert into questions values (1,'Hello') insert into questions values (2,'How are you') insert into questions values (3,"I'm fine and you?") insert into questions values (4,"Not bad.") index on rank tag rank * For your case this could be a RW cursor selected from qtable *Form.Keypress && Keypreview .t., no check if we're in grid!!! LPARAMETERS nKeyCode, nShiftAltCtrl if nKeyCode = 24 and rank < reccount() && down nodefault this.Swap(rank,1) endif if nKeyCode = 5 and rank > 1 && up nodefault this.Swap(rank,-1) endif * Form custom swap method lparameters tnPos, tnRelative with this copy to array arrTemp arrTemp[tnPos,1] = tnPos+tnRelative arrTemp[tnPos+tnRelative,1]=tnPos with .Grid1 lnCol = .Activecolumn .Recordsource='' zap append from array arrTemp .Recordsource='Questions' go tnPos .refresh .Columns(lnCol).setfocus() endwith endwithCetin