Hi to all. Trying to get a onclick VBA routine to run, but I'm getting an error message when I click on the button that is used to run the VBA code to change/update a memo field in a table. This routine is only called one time after the table is reloaded monthly. There is data in this memo field that needs to be converted, exam "<crlflf>" should be changed to "Chr(13) Chr(10) Chr(10)".
The error message I receive is "Update or CancelUpdate without AddNew or Edit". Hope someone can help me and thanks in advance.
Here is the code for the onclick:
=============== =============== =============== ========
The error message I receive is "Update or CancelUpdate without AddNew or Edit". Hope someone can help me and thanks in advance.
Here is the code for the onclick:
=============== =============== =============== ========
Code:
Private Sub FixMemoField_Click()
On Error GoTo Err_FixMemoField_Click
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("Translated_memo")
While Not rs.EOF
rs.Update
rs!memofieldname = Replace(rs!trans_memo, "<crlf>", Chr(13) & Chr(10))
rs!memofieldname = Replace(rs!trans_memo, "<crlflf>", Chr(13) & Chr(10) & Chr(10))
rs.Update
rs.MoveNext
Wend
Exit_FixMemoField_Click:
Exit Sub
Err_FixMemoField_Click:
MsgBox Err.Description
Resume Exit_FixMemoField_Click
End Sub
Comment