Updating Memo Field from form Control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jglabas
    New Member
    • Jun 2008
    • 9

    Updating Memo Field from form Control

    I have a form with an unbound control called RevevantDateNot es. This is used to gather and update information stored on a table field of type Memo, with the same name (RevevantDateNo tes).

    The After Update [Event] is shown below:

    I need to store an email (cut and past) of a resignation letter. When I cut and paste a letter into the form field, I get the following error with a portion of the letter embedded in the error message:

    3075 - Syntax error in query expression "Date Wed 29 Oct 21:37:57 [about 255 characters of the letter, ending with single quote] . . . team. I expec'.

    There are no single or double quotes embedded in the letter.

    Looks like the statement "Dim RelevantDateNot es As String" limits me to 255 characters as when I remove spaces, a few more characters of the letter show up in the error message. When I dhortent he inout, it works without an error message.

    How can I store the entire letter in the memo field.

    -------------- Event Code ------------
    Code:
     Private Sub RelevantDateNotes_AfterUpdate()
    On Error GoTo Err_RelevantDateNotes_AfterUpdate
    
    Dim Member_ID As Integer
    Dim RelevantDateNotes As String
    
    RelevantDateNotes = Me.RelevantDateNotes
    Member_ID = Me.Member_ID
    
    'update table with current notes
    temp_sql = "UPDATE tbl_J_MemberDates "
    temp_sql = temp_sql & " SET RelevantDateNotes = '" & RelevantDateNotes & "' "
    temp_sql = temp_sql & " WHERE mmMember = " & Member_ID & " "
    
    DoCmd.SetWarnings False
    DoCmd.RunSQL (temp_sql)
    DoCmd.SetWarnings True
    
    Exit_RelevantDateNotes_AfterUpdate: ' Label to resume after error.
    Exit Sub ' Exit before error handler.
    
    Err_RelevantDateNotes_AfterUpdate: ' Label to jump to on error.
    MsgBox Err.Number & " - " & Err.Description ' Place error handling here.
    Resume Exit_RelevantDateNotes_AfterUpdate ' Pick up again and quit.
    
    End Sub
  • jglabas
    New Member
    • Jun 2008
    • 9

    #2
    Disregard. The above code works.

    Comment

    Working...