Exporting Memo Field to Word

ChrisCione

Board Regular
Joined
Aug 27, 2008
Messages
92
Office Version
  1. 365
Platform
  1. Windows
I have a command button on my form which allows me to export Access fields to corresponding fields in a Word fillable form. It works perfectly except for a memo field that I use. The character count in the memo field is usually pretty high (in the thousands, i'm sure). I've done research and have learned that Access usually will truncate the data, however, mine's not showing at all. I've tripled checked that the field name in Access and the field name in Word are correct, and I've checked that the field in Word is set to unlimited text. But it won't export the data at all.

Does anyone have suggestions (the solutions I've found are relative to Excel)?

By the way, here's the code, if needed:
Private Sub CommandERSRGB_Click()
Dim appWord As Word.Application
Dim doc As Word.Document
'Avoid error 429, when Word isn’t open.
On Error Resume Next
Err.Clear
'Set appWord object variable to running instance of Word.
Set appWord = GetObject(, "Word.Application")
If Err.Number <> 0 Then
'If Word isn’t open, create a new instance of Word.
Set appWord = New Word.Application
End If
Set doc = appWord.Documents.Open("L:\Bper Spec\Cione\Database Files\Announcement (ERS Rep GridBased).doc", , True)
With doc
.FormFields("Duties").Result = Me!Duties
.Visible = True
.Activate
End With
Set doc = Nothing
Set appWord = Nothing
Exit Sub

errHandler:
MsgBox Err.Number & ": " & Err.Description
End Sub


The code just shows one field "Duties"; there are actually several others.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I have a command button on my form which allows me to export Access fields to corresponding fields in a Word fillable form. It works perfectly except for a memo field that I use. The character count in the memo field is usually pretty high (in the thousands, i'm sure). I've done research and have learned that Access usually will truncate the data, however, mine's not showing at all. I've tripled checked that the field name in Access and the field name in Word are correct, and I've checked that the field in Word is set to unlimited text. But it won't export the data at all.

Does anyone have suggestions (the solutions I've found are relative to Excel)?

By the way, here's the code, if needed:
Private Sub CommandERSRGB_Click()
Dim appWord As Word.Application
Dim doc As Word.Document
'Avoid error 429, when Word isn’t open.
On Error Resume Next
Err.Clear
'Set appWord object variable to running instance of Word.
Set appWord = GetObject(, "Word.Application")
If Err.Number <> 0 Then
'If Word isn’t open, create a new instance of Word.
Set appWord = New Word.Application
End If
Set doc = appWord.Documents.Open("L:\Bper Spec\Cione\Database Files\Announcement (ERS Rep GridBased).doc", , True)
With doc
.FormFields("Duties").Result = Me!Duties
.Visible = True
.Activate
End With
Set doc = Nothing
Set appWord = Nothing
Exit Sub

errHandler:
MsgBox Err.Number & ": " & Err.Description
End Sub


The code just shows one field "Duties"; there are actually several others.

Have you considered using bookmarks in the word document and then record a macro to find the bookmark (ie in Word record macro and then use F5 select the bookmark to go to then stop recording) Open the macro and use the code and copy it into Access where you want the memo field to show its data.

Trevor G
 
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,024
Members
449,092
Latest member
ikke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top