Question

Locked

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
text.

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
err.Clear
'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
.Activate
End With

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

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums