Link to home
Start Free TrialLog in
Avatar of MitchellVII
MitchellVIIFlag for United States of America

asked on

Access Memo Fields being truncated when imported in Form Fields.

Hi,

I have a Mail Merge Document that contains { FORMTEXT } Form Fields corresponding to all of the .MailMerge.DataSource.DataFields values in my document.  I run the following code to populate the { FORMTEXT } Form Fields with my MERGE data:

'Fills Form Fields with data from matching MergeFields:
Dim mmdf As MailMergeDataField

For Each mmdf In ThisDocument.MailMerge.DataSource.DataFields
    ThisDocument.FormFields(mmdf.Name).Result = ThisDocument.MailMerge.DataSource.DataFields(mmdf.Name).Value
Next


This works perfectly; however, I have noticed that when one of my DataFields is a LONG STRING, it truncates the text in my Form Field, although my Form Field is set to TEXT | UNLIMITED.  My .DataSource is a .txt file emported from Access.

Anyone know why this is and how to overcome it?

Mitchell
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MitchellVII

ASKER

Wow,

That one made my brain hurt.  Ok, how would I apply that to this code:

'Fills Form Fields with data from matching MergeFields:
Dim mmdf As MailMergeDataField

For Each mmdf In ThisDocument.MailMerge.DataSource.DataFields
    ThisDocument.FormFields(mmdf.Name).Result = ThisDocument.MailMerge.DataSource.DataFields(mmdf.Name).Value
Next

if I have an Access Memo Field called "ContactSynopsis" that is a MERGEFIELD which I want to use to populate my FORMTEXT field by the same name?  Here is their code for reference:

Sub WorkAround255Limit()
      ' Set Text1 form field to a unique string.
      ActiveDocument.FormFields("text1").Result = "****"
      If ActiveDocument.ProtectionType <> wdNoProtection Then
          ActiveDocument.Unprotect
      End If
      Selection.GoTo What:=wdGoToBookmark, Name:="Text1"
      Selection.Collapse
      Selection.MoveRight wdCharacter, 1
      Selection.TypeText (String(256, "W"))
      Selection.GoTo what:=wdGoToBookmark, Name:="Text1"
      ' Remove unique characters from Text1 form field.
      With Selection.Find
         .Execute findtext:="*", replacewith:="", replace:=wdReplaceAll
      End With
      ActiveDocument.Protect Password:="", NoReset:=True, Type:= _
         wdAllowOnlyFormFields
   End Sub

P.S., did you see my question regardind coloring table cells?   That's a toughie I think :)

M