Update/Append corrupting Memo field after 512 characters

completelybobbins

New member
Local time
Today, 05:29
Joined
Nov 10, 2009
Messages
6
Update/Append corrupting Memo field after 512 characters (Resolved)

Hi Folks

Can't find anything on searching about this, but apologies if I've just missed something...

Example db attached (open form 'frmTest')

If I load the contents of a memo field into a form's textbox, add any characters which make the string longer than 512 (ASCII?) characters (with carriage returns counting as 2), and then try and update the record with the contents of the textbox, all characters after the 512th are scrambled.

No formatting on either the textbox, or the table field.

This occurs with update and append. If I enter the extra characters directly into the table the problem doesn't occur. No '," or anything that might cause sql problems.

Comments appreciated, even if it's just a could not reproduce! I'm convinced this must be some daft setting I've missed, otherwise the web would be covered in posts about it.

Cheers

Rob
 

Attachments

Last edited:
Change your update code to this:
Code:
Private Sub cmdUpdate_Click()
    SQL = "UPDATE tblTest SET tblTest.[testMemo] = " & Chr(34) & [Forms]![frmTest]![testMemo] & Chr(34) & _
" WHERE (((tblTEST.testID)= " & [Forms]![frmTest]![testID] & "))"
    DoCmd.RunSQL SQL
    
End Sub

So it is not having to try to evaluate the values but instead you are passing the explicit values from the form references. It doesn't have a problem if you do that. (also, it doesn't have a problem if the form is bound).
 
Oh, and I would change to using CurrentDb.Execute instead of DoCmd.RunSQL:
Code:
    CurrentDb.Execute SQL, dbFailOnError
 

Users who are viewing this thread

Back
Top Bottom