Exporting Access data into Word FormField Error

R

Robert S.

Access doesn't seem to allow me to export a Memo data
field from Access into a Word FormField when the
corresponding memo type field in Access is over a certain
length.

I get a "4690String too long" error message. The
corresponding FormField in Word is designated as "Regular
Text" and set to Unlimited in size..

I am exporting the data from the Access memo field, into
the word formfield by using the following line:

..FormFields("DescriptionLead").Result = Nz(Me!
DescriptionOperations)

Thanks for any help.
 
A

Andi Mayer

On Thu, 14 Aug 2003 11:02:33 -0700, "Robert S."


is Me!DescriptionOperations from a SQL statement?

if yes then it is a string and no Memo anymore eg: varchar(254)

MW
 
R

Robert S.

Sorry, I should have made it more clear.

Me!DescriptionOperations is part of a recordset:

===================================
Dim appWord As Word.Application
Dim doc As Word.Document
Dim rst As ADODB.Recordset
Dim strSQL As String
Dim strLeadID As String

On Error Resume Next
Set appWord = GetObject(, "Word.application")
If Err = 429 Then
Set appWord = New Word.Application
Err = 0
End If

strLeadID = LeadID
'It gets LeadID from the form which this subroutine runs
from.

With appWord
Set doc = .Documents(DOC_NAME)
If Err = 0 Then
If MsgBox("Do you want to save the current
document " _
& "before updating the data?", vbYesNo) =
vbYes Then
.Dialogs(wdDialogFileSaveAs).Show
End If
doc.Close False
End If

On Error GoTo ErrorHandler

Set doc = .Documents.Open(DOC_PATH & DOC_NAME, , True)
Set rst = New ADODB.Recordset

If Not IsNull(Me!LeadID) Then
strSQL = "SELECT LeadCompanies.* From
LeadCompanies WHERE LeadCompanies.LeadID = " & strLeadID
rst.Open strSQL, CurrentProject.Connection,
adOpenStatic, adLockReadOnly
If Not rst.EOF Then
rst.Close
End If
End If

With doc
.FormFields("Lead").Result = Nz(Me!CompanyName)
.FormFields("Address").Result = Nz(Me!
MailingAddress)
.FormFields("Province").Result = Nz(Me!Province)
.FormFields("PostalCode").Result = Nz(Me!Postal)
.FormFields("Country").Result = Nz(Me!Country)
.FormFields("Web").Result = Nz(Me!WebAddress)
.FormFields("leadID").Result = Nz(Me!LeadID)
.FormFields("DescriptionLead").Result = Nz(Me!
DescriptionOperations)
End With



.Visible = True
.Activate
End With

doc.Close True
Set rst = Nothing
Set doc = Nothing
Set appWord = Nothing
 
R

Robert S.

Oh....I understand what you mean...it gets converted to a
string...

So how do I increase the string length? Am I really
limited to 254 characters?
 
A

Andi Mayer

On Thu, 14 Aug 2003 12:50:03 -0700, "Robert S."

I had once the same problem, but I can't remember why, maybe it was
Access97 or Access2000. I tried it with AccessXP and I don't have the
problem anymore or was it an office update that solved this problem.

But half I year ago I couldn't use more than 254 charactors of a memo
field in a report.

Maybe somebody else can sheed light on my confusion?
 
R

Robert S.

I'm using Access 2002/XP as well.
-----Original Message-----
On Thu, 14 Aug 2003 12:50:03 -0700, "Robert S."

I had once the same problem, but I can't remember why, maybe it was
Access97 or Access2000. I tried it with AccessXP and I don't have the
problem anymore or was it an office update that solved this problem.

But half I year ago I couldn't use more than 254 charactors of a memo
field in a report.

Maybe somebody else can sheed light on my confusion?



.
 
T

Tim Ferguson

I am exporting the data from the Access memo field, into
the word formfield by using the following line:

Look up help for GetChunk and AppendChunk

HTH

Tim F
 
C

Cindy Meister -WordMVP-

Hi Robert,
Access doesn't seem to allow me to export a Memo data
field from Access into a Word FormField when the
corresponding memo type field in Access is over a certain
length.
The problem is a limitation on the Word-VBA end of things.
See this KB article:

WD97: "String Too Long" Using Over 255 Characters [Q163192]
http://support.microsoft.com?kbid=163192

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan
24 2003)
http://www.mvps.org/word

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top