>LOCAL loColumn, loActiveControl, loControl, llRetVal > >llRetVal = .T. >IF TYPE( 'Thisform.ActiveControl.Name' ) = 'C' > loActiveControl = Thisform.ActiveControl > IF UPPER( loActiveControl.BaseClass ) # 'GRID' > *** If there is code in the valid method of the active control > *** And the entry is invalid, the error message will display > *** But the rest of the code code will continue to run and save > *** the bad data anyway. So we cannot just issue a SetFocus() > IF NOT EMPTY( loActiveControl.Valid() ) > *** We still have to cause the Valid to fire to update the data > *** from what is in the buffer because the previous line > *** does not cause the Valid to fire, it merely runs any code > *** in that method > loActiveControl.SetFocus() > llRetVal = .T. > ELSE > llretVal = .F. > ENDIF > ELSE > FOR EACH loColumn IN loActiveControl.Columns > IF loActiveControl.ActiveColumn = loColumn.ColumnOrder > loControl = EVAL( 'loColumn.'+ loColumn.CurrentControl ) > IF NOT EMPTY( loControl.Valid() ) > loControl.SetFocus() > llRetVal = .T. > ELSE > llRetVal = .F. > ENDIF > EXIT > ENDIF > ENDFOR > ENDIF >ENDIF > >RETURN llRetVal >