none
Best Practices Question For Concatenation With A Memo Field, Office 2007 RRS feed

  • Question

  • I think I meant to post this to the Access developers forum but I'm not sure how to change!

     

    I have the following code which is working just fine for sending data to an MS Word file. However the rst I'm sending out is a memo field.
    When I'm just sending out the raw data, the entire memo field comes out. When I append data to the memo field, the data is truncated and not everything comes out.

    I know this is a known issue but I'm wondering the best way to deal with this. I can't even concatenate and send to a separate memo field for export because the truncating bit happens.

    Suggestions?

    DoCmd.SetWarnings False
    DoCmd.OpenQuery "MyQuery"
    DoCmd.SetWarnings True
    WordObj.ActiveDocument.Bookmarks("concl").Select
    MySQL = "select * from T_Letter_Generate_CIVPEN_Conc where id= '" & MYID & "'"
    Set RST1 = DB.OpenRecordset(MySQL, dbOpenDynaset)
    If Not (RST1.BOF And RST1.EOF) Then
    RST1.MoveLast
    MyRecCount1 = RST1.RecordCount
    RST1.MoveFirst
    N = MyRecCount1
    Do While Not RST1.EOF
    WordObj.Selection.Range.Text = N & ". " & MyLawStart & "violated " & RST1!lawstuff & " " & RST1!blahblahblah& vbCr & vbCr
    RST1.MoveNext
    N = N - 1
    Loop
    End If
    RST1.Close


    Monday, July 18, 2011 6:56 PM

Answers

  • Hi Becky

    Yes, that's what I'm suggesting and why would it trunctate to 255? To my knowledge, the number of characters a string can hold is not limited (unless this is a limitation of Access, although that would surprise me). But certain Word functions certainly are...

    If you've tried it and it indeed doesn't work then... (Ah, and don't forget to try it with Rst1.Fields("FieldName").Value as using Value could make a diffrence)

    <<When I'm just sending out the raw data, the entire memo field comes out. When I append data to the memo field, the data is truncated and not everything comes out.>>

    I'm not following you with this statement. What do you mean by "the raw data" vs. "append the data"?


    Cindy Meister, VSTO/Word MVP
    Tuesday, July 19, 2011 12:43 PM
    Moderator

All replies

  • Hi Becky

    I take it the problme is RST1!Lawstuff and/or something like that? Does the truncation happen if you do something more like:

    Dim memoContent as String
    memoContent = RST1!lawstuff
    WordObj.Selection.range.Text = N & ". " & MyLawStart & "violated " & memoContent


    Cindy Meister, VSTO/Word MVP
    Tuesday, July 19, 2011 11:38 AM
    Moderator
  • Are you telling me to dim the memo field as a string?  That would truncate the memo field to 255...

    Tuesday, July 19, 2011 12:00 PM
  • Hi Becky

    Yes, that's what I'm suggesting and why would it trunctate to 255? To my knowledge, the number of characters a string can hold is not limited (unless this is a limitation of Access, although that would surprise me). But certain Word functions certainly are...

    If you've tried it and it indeed doesn't work then... (Ah, and don't forget to try it with Rst1.Fields("FieldName").Value as using Value could make a diffrence)

    <<When I'm just sending out the raw data, the entire memo field comes out. When I append data to the memo field, the data is truncated and not everything comes out.>>

    I'm not following you with this statement. What do you mean by "the raw data" vs. "append the data"?


    Cindy Meister, VSTO/Word MVP
    Tuesday, July 19, 2011 12:43 PM
    Moderator