String Length Limit in Form Fields??

String Length Limit in Form Fields??

Post by JP » Mon, 15 Dec 2003 11:26:40

I have an Access 2000 application that I'm using to enter data in text Form
Fields in various Word 2000 documents. The code I'm using in Access is
similar to this:

Dim wordApp As Word.Application
Dim wordDoc As Word.Document
Set wordApp = CreateObject("Word.Application")
Set wordDoc = wordApp.Documents.Open(vDocname,False, True, False, , , True,
, , , , False)
wordDoc.FormFields("FF1").Result = vData1
wordDoc.FormFields("FF2").Result = vData2, etc.

where vData1 and vData2 are data elements coming from the database.

The strings to be put into the Word documents are long strings of text.
When the string is longer than 255 characters, I get Run-time error 4609
(String too long). Is there a limit on passing text through automation? Is
there any way around it?

I want to use FormFields (rather than bookmarks) because the client wants
the Word documents protected to prevent them from being changed by users --
and use of bookmarks would require me to unprotect the form, insert the
text, and then re-protect the form (thus creating the possibility of a
failure that will leave the form unprotected).

Thanks in advance.

String Length Limit in Form Fields??

Post by Cindy M -W » Tue, 16 Dec 2003 02:01:45

Hi Jp,

Your observation is correct, and I think if you search the Knowledge Base on you'll find an article on the subject, with a workaround. As I
recall, the workaround is basically to unprotect, insert the data into
the bookmark range (a formfield is also a bookmark), then reprotect.

Cindy Meister
INTER-Solutions, Switzerland (last update Sep 30 2003)

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)