>>theFld=thisform.edtReplaceFld.value && "trimzero(StNumExt)" >>theType=type(m.theFld)&& Returns U
>theFld=thisform.edtReplaceFld.value && "trimzero(StNumExt)" >ON ERROR m.VarToCheck = Null >m.VarToCheck = eval(theFld) >ON ERROR && whatever was before >? vartype(m.VarToCheck) && this will not fail >>
>oEvaluator = createobject("Evaluator") >m.VarToCheck = oEvaluator.Eval(theFld) && avoids placing ON ERROR in each evaluation >? vartype(m.VarToCheck) && this will not fail >>
******************************************************************* * Description.......: ChkFldType - Check that the replacement types are valid * Calling Samples...: * Parameter List....: * Created by........: Nadya Nosonovsky 06/22/2000 03:40:34 PM * Modified by.......: Nadya Nosonovsky 10/24/2002 11:35:02 AM ******************************************************************** local theType, theFld, llReturn, lnOption, lcTest lnOption = thisform.GlobOpt.value thisform.lOtherError = .f. do case case m.lnOption = 1 && Replace with constant theFld=thisform.txtReplaceVal.value theType=type('theFld') if m.theFld = "Clear Value" theFld = "" endif case m.lnOption = 2 && Replace with field/combination of fields theFld=thisform.edtReplaceFld.value theType=type(m.theFld) * Suggestion from Tracy Holzer if m.theType = "U" and "(" $ m.theFld && VFP doesn't recognize functions correctly lcTest = &theFld theType=type("m.lcTest") endif case m.lnOption = 3 && Swap theFld=thisform.SwapFld theType=type(m.theFld) endcase if thisform.lOtherError llReturn = .f. else if empty(m.theFld) or thisform.CompareTypes(m.theType,thisform.cFieldType) llReturn = not thisform.lOtherError else llReturn = .f. endif endif return m.llReturn && and not thisform.lOtherErrorE.g. I have Error method for the form already. I used macro, because I don't know in advance (expression may become very complicated and exceed 255 evaluate function limit).