>> IF TYPE("_screen.activeform.ActiveControl.Name") = "C"
>> _screen.activeform.ActiveControl.SetFocus()
>> ENDIF
>IF GETFLDSTATE(0) % 2 = 1 AND TYPE("THISFORM.ActiveControl") == "O" AND ;
> UPPER(THISFORM.ActiveControl.BaseClass) <> "GRID"
> IF TYPE("THISFORM.ActiveControl.ControlSource") <> "U" AND ;
> !EMPTY(THISFORM.ActiveControl.ControlSource)
> IF EVAL(THISFORM.ActiveControl.ControlSource) <> THISFORM.ActiveControl.Value
> REPLACE (THISFORM.ActiveControl.ControlSource) WITH THISFORM.ActiveControl.Value
> IF ALLTRIM(EVAL(THISFORM.ActiveControl.ControlSource)) = ALLTRIM(THISFORM.ActiveControl.Value)
> llRetVal = .T.
> ELSE
> llRetVal = .F.
> ENDIF
> ENDIF
> ENDIF
>ENDIF
Marcia,
Three lines of code versus 12 lines <g>. Also TYPE("Blah") = "O" is not a full check for an object, the var may be type O and be value NULL, in this case you other checks would error. This is why I check TYPE("Blah.Name") = "C", because Blah may be type O and value is NULL but Blah.Name will only be type C if the object exists. Also your code will do a replace on the field, but the control will also update the field again when it loses focus. GetFldState will become dirty even if you replace the field with the same value it already has.
As for the THIS.Value = File.Field, that line dirties the buffer.