Endless output using OUTPUTTO MsWord

Endless output using OUTPUTTO MsWord

Post by mal_lor » Wed, 23 Jun 2004 23:05:44


I have a button on a form that outputs a report to word.
While it has been working well for a while, today it is not.

The behaviour now is that it endlessly outputs pages to word. There
are just 63 records (report pages) to output....I hit cancel when the
counter was in the 10'000 range.

Here is my code....any ideas??

Private Sub btnSend2Word_Click()
On Error GoTo Err_btnSend2Word_Click

Dim stDocName As String
stDocName = "rptMailSorted"

DoCmd.OutputTo acOutputReport, stDocName, acFormatRTF, "C:\My
Documents\CamperMail.doc", True
MsgBox "File Created."
DoCmd.Close acForm, Me.Name
DoCmd.Close acForm, "frmMain"
DoCmd.OpenForm "frmMain"
Exit Sub

MsgBox Err.Description
Resume Exit_btnSend2Word_Click

End Sub

Endless output using OUTPUTTO MsWord

Post by Doug Hutch » Thu, 24 Jun 2004 08:03:04

Sounds as though your report contains some code which is in a while loop
which is never ending - an infinite loop.
Is there any code behind the report? Does the report behave when you open it
from Access instead of shipping it to Word?



Endless output using OUTPUTTO MsWord

Post by mal_lor » Thu, 24 Jun 2004 23:12:45


Thanks for your help. Here I was assuming that the problem was with
the export.

I have no code behind the report except for a NODATA and
ONCLOSE...both work fine.
The problem is with a certain record.
I have several fields (listed below) but I am thinking that the
problem is probably with the Message field (memo type).
For the problem record this field LEN is 3872. Does this exceed some
Or should I be searching within that field for some bad character??

Should I create an "overflow" field that I can dump the extra into and
then just format the report to have it all read together? or is there
a better approach??.

As it stand I go through this process.
1. download the raw (.txt) file (comma delim)
2. Clean it up...involves replacing the instaces of (a small box
character) with a (chr$(13)+chr$(10))...the text file doesn't hold the
enter characters.
3. Open the report for printing or exporting to Word.

Thanks again,

Table fields are....
dteDate - date field - Posting Date
dteTime - time field - Posting Date
txtFrom - Text field
txtTo - Text Field
cmboSite - Text Field
PreppedForPrint - Yes/No
Printed - yes/no
tblCamperMailID - Autonumber

Endless output using OUTPUTTO MsWord

Post by Doug Hutch » Fri, 25 Jun 2004 07:31:46

Top post fixed - see below...)

in message news:<IU2Cc.169$ XXXX@XXXXX.COM >...
open it
"Mal" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...

Hmmm...memo fields can sometimes be an issue, but I have not seen this
particular behaviour before.

What happens when you run the report directly from Access, instead of piping
it to Word? Does it go haywire there as well?

If you suspect the one record, try modifying your recordsource to be a query
which selects only that record and see if the problem persists. If so, you
may have a dicey record in the table. Usual practice with an data corruption
issue would be to perform a Repair on the database, but something in my
waters tells me there was a question over whether this was regarded as a
Good Thing (tm) for solving problems with memo fields. If you really do
narrow it down to a problem with that field, I would suggest you wait for a
more informative answer from one of the other experienced people in this
ng - I would hate to tell you to do something which only made things worse !

Would one of my esteemed peers in the group care to jump in here and shed
light on the pros and cons of attempting to solve problems with memo fields
by performing Repair?

Kind regards,


Endless output using OUTPUTTO MsWord

Post by Mal Reev » Fri, 25 Jun 2004 10:29:55

"Doug Hutcheson" < XXXX@XXXXX.COM > wrote
in message news:mxnCc.185$ XXXX@XXXXX.COM ...

Sorry abou the top post...

When the report is opened in Access it gets the smae haywire behaviour.
I identified 1 record that causes it. When it is filtered out the report
runs fine.
When it is the only record....it's still going haywire.....stranger and



Endless output using OUTPUTTO MsWord

Post by pietlinde » Sat, 26 Jun 2004 13:40:04


Sounds like a corrupt record. Try exporting the record to text,
deleting the record from the database and reimporting it from the text