• Creator
  • #2146367

    Move large memo field from access form to word doc via cmd button on form


    by joe_ferrara28 ·

    I have a form in access, I want to transfer fields within the form to a word
    doc. I’m using a command button on the access form to open the word doc and
    move the data to word, everything works. I’m able to move 4 of the 5 field
    of data to the word doc except the memo field, since the field contains more
    than 255 characters the data isn’t moveing over to the defined txt field on
    the word doc. Any suggestions on how I can move over this large string of

    Private Sub cmdMoveData_Click()
    Dim appWord As Object
    Dim doc As Object
    Dim FilePath As String

    FilePath = “C:\_ProjectFolders\MoveData

    ‘Avoid error 429, when Word isn?t open.
    On Error Resume Next
    ‘Set appWord object variable to run instance of Word.
    Set appWord = CreateObject(“Word.Application”)
    Set doc = appWord.Documents.Open(FilePath, , True)

    With doc
    .FormFields(“hi_IntDate”).Result = Me!textfield1
    .FormFields(“hi_ResultsCampusePre”).Result = Me!textfield2
    .FormFields(“hi_ResultsCampusePTx”).Result = Me!textfield3
    .FormFields(“hi_ResultsResidtlTra”).Result = Me!textfield4
    .FormFields(“hi_ResultsNarrative”).Result = Me!memofield1
    these are the data fields I’m moving over the last move is a memo field and
    since the field contains more than 255 characters the data is not moving to
    the word doc.
    .Visible = True
    End With

    Set doc = appWord.Documents.Open(FilePath, , True)
    Set doc = Nothing
    Set appWord = Nothing
    Exit Sub
    MsgBox “An error of code ” & err & ” has occurred: ” & Error, 48,
    “fsubHomeInt – cmdMoveData_Click”
    End Sub

All Answers

Viewing 0 reply threads