if !empty(lcString) then replace myMemofield with myMemoField + lcString + chr(13) in myAlias endifthen I got my err message, can not update the cursor, any ideas why?
LPARAMETERS lcAction, lcAlias, lcFieldToUpdate LOCAL lnFields PUBLIC lcString DO CASE CASE lcAction = 'I' CASE lcAction = 'U' *:esta modificando el registro, entonces se deberan registrar todos *:los posibles cambios que el usuario haya efectuado junto con el *:numero de usuario, la computadora, la hora y fecha de la modificacion lnFields = FCOUNT(lcAlias) lcString = '' *:Se obtienen los valores antiguos y actuales de cada campo FOR _N = 1 TO lnFields _Pos = ALLTRIM(STR(_N)) _FieldName = '_FieldVar' + _Pos _OldValue = '_OldValVar' + _Pos _NewValue = '_NewValVar' + _Pos &_FieldName = FIELD(_N) *:Convirtiendo cualquier tipo de dato que sea en caracter para poder unirlo con los demas _VariableNewValueType= TYPE(FIELD(_N)) _FieldName2 = lcAlias + '.' + FIELD(_N) _VariableNewValue = &_FieldName2 *:Unicamente si es de tipo logico se cambia, de cualquier otro tipo se utiliza *:el PADL para convertirlo a caracter Do Case Case _VariableNewValueType = [L] &_NewValue = IIF(_VariableNewValue,'.T.','.F.') OtherWise &_NewValue = ALLTRIM(PADL(_VariableNewValue,256)) EndCase _VariableOldValue = OLDVAL(FIELD(_N,lcAlias),lcAlias) _VariableOldValueType= TYPE('_VariableOldValue') Do Case Case _VariableOldValueType = [L] &_OldValue = IIF(_VariableOldValue,'.T.','.F.') OtherWise &_OldValue = ALLTRIM(PADL(_VariableOldValue,256)) ENDCASE *:si el valor del campo cambio, entonces se registra el cambio, de lo contrario se omite IF _VariableNewValue <> _VariableOldValue THEN lcString = lcString + &_FieldName + ' ' + &_OldValue + ' ' + &_NewValue + ' ' ENDIF ENDFOR SET STEP ON IF !EMPTY(lcString) THEN lcFieldToUpdate = lcAlias + '.' + lcFieldToUpdate replace &lcFieldToUpdate WITH &lcFieldToUpdate + CHR(13) IN &lcAlias &&err message here ENDIF CASE lcAction = 'D' ENDCASE RETURN .T.
DO WHILE .T. ME.Work() ENDDO