******************************************************************** * Description.......: ValidateGrid - validates MortgGrid on Sales and Mortgage pages * Calling Samples...: * Parameter List....: tcTable, toGrid * Created by........: Nadya Nosonovsky 07/25/2002 02:57:47 PM * Modified by.......: Nadya Nosonovsky 10/01/2002 12:47:12 PM ******************************************************************** lparameter tcTable, toGrid local llReturn, lnSelect lnSelect = select() llReturn = .t. with thisform if not .CancelValidation() *!* * code from 06/06/2002 Vlad Grynchyshyn local oObj oObj = .activecontrol if vartype(m.oObj) == "O" if PEMSTATUS(m.oObj,"DoValid",5) m.oObj.DoValid = .f. && Don't want to fire validation endif && If it's a grid, we need to calculate the active control if upper(m.oObj.baseclass) == "GRID" nIndex = m.oObj.activecolumn for i=1 to m.oObj.columncount if m.oObj.columns(i).columnorder = m.nIndex nIndex = m.i exit endif endfor oObj = m.oObj.columns(nIndex) oObj = evaluate("m.oObj." + m.oObj.currentcontrol) endif *!* && Check if control has different value than its ControlSource if !(m.oObj.value==evaluate(m.oObj.controlsource)) **oObj.setfocus && This is enough to write changes into ControlSource m.oObj.value = m.oObj.value && Updated:NN: 06/07/02 endif endif select (m.tcTable) scatter name oBlank blank scatter name oCheck if compobj(oBlank, oCheck) && It's a completely blank record - don't validate it else llReturn = .MortgageValid(evaluate(m.tcTable+'.mortgage'), ; evaluate(m.tcTable+".Lender"), 0,'M' ) if not m.llReturn if empty(evaluate(m.tcTable+".Lender")) ** Set focus to the Lender column toGrid.colLender.setfocus() else ** Set focus to the Mortgage column toGrid.colMortgage.setfocus() endif endif if m.llReturn llReturn = .ValidateLender(evaluate(m.tcTable+'.Lender'), ; evaluate(m.tcTable+".LName")) if not m.llReturn toGrid.colLender.setfocus() endif endif if m.llReturn llReturn = .BookPageValid(evaluate(m.tcTable+'.Book'), ; evaluate(m.tcTable+'.page'), ; evaluate(m.tcTable+'.DocketRef'),' ') if not m.llReturn toGrid.colPage.setfocus() endif endif endif select (m.lnSelect) && Return back endif endwith return m.llReturnNow it works as I desired.