* Guarantees that a fieldname is valid for VFP. FUNCTION GuaranteeFieldName( tcFName ) * local lcC, lcC1, lm * lcC = alltrim( tcFName ) * if not isalpha( lcC ) * lcC = 'X' + lcC endif * for lm = 2 to len( alltrim( lcC ) ) && replace troublesome characters with an underscore * lcC1 = substr( lcC, lm, 1 ) * if not lcC1 = '_' and not isalpha( lcC1 ) and not isdigit( lcC1 ) * lcC = left( lcC, lm - 1 ) + '_' + substr( lcC, lm + 1 ) endif next * RETURN lcC FUNCTION CheckFieldNames lparameter taField && one-dim local ln, lcMsg lcMsg = "" for ln = 1 to alen( taField ) * if ascan( taField, taField[ ln ], ln + 1, -1, 1, 1+6 ) > 1 && 1+6=case-insensitive + exact on * lcMsg = "Duplicate field name found: " + taField[ ln ] EXIT endif next RETURN lcMsg