Export from Access to Word, 255 char limit

adrienne_r30

Registered User.
Local time
Today, 16:40
Joined
Jan 20, 2015
Messages
48
First off, not sure if this is technically a Word question or Access question, but I'll try here first.

I have a form in Access where there are many fields filled in. I've created code that, once a button is pressed, it transfers those fields into a word document by finding the form fields I created in the word doc and filling them in. This works just fine. The problem is when I have a memo field in Access. If it is more than 255 characters, it won't transfer over. I found some code to use in Word to rectify this problem, but I'm not quite sure how to work VBA in Word, also not sure if that code is correct. Either way, is that something I can fix in my Access code, of does this have to be done in Word? And is there anyone that can help?

Thanks so much
 
I am using this code in my access code I have already that exports all of my other fields. I am having a problem though. it will only export 1000 characters of the first letter in my field, 'Bridge_Description'. I have been trying for a while to mess with this code to make it export the whole field, but no luck yet. Can anyone help with this?

' Set Text1 form field to a unique string.
.FormFields("fldBridgeDesc1").Result = "****"
Selection.GoTo what:=wdGoToBookmark, Name:="fldBridgeDesc1"
Selection.Collapse
Selection.MoveRight wdCharacter, 1
Selection.TypeText (String(1000, [Forms]![frm_Data_Entry]![sbfrm_Data_Entry_Bridge]![Bridge_Description]))
Selection.GoTo what:=wdGoToBookmark, Name:="fldBridgeDesc1"
' Remove unique characters from Text1 form field.
With Selection.Find
.Execute findtext:="*", replacewith:="", Replace:=wdReplaceAll
End With
 
Solution:
I tinkered around long enough and figured it out. If anyone would like to export more than 255 characters from an Access field to a Word form field, use this code in Access:

.FormFields("Word_Form_Field_Name").Result = "****"
Selection.GoTo what:=wdGoToBookmark, Name:=" Word_Form_Field_Name "
Selection.Collapse
Selection.MoveRight wdCharacter, 1
Selection.TypeText ([Forms]![Access_Form_Name]![Field])
Selection.GoTo what:=wdGoToBookmark, Name:=" Word_Form_Field_Name "
' Remove unique characters from Word_Form_Field_Name form field.
With Selection.Find
.Execute findtext:="*", replacewith:="", Replace:=wdReplaceAll
End With
 

Users who are viewing this thread

Back
Top Bottom