problem exporting reports to word

S

Sacapuce

I am using Access 2007 to produce a report based on a query.

The report has for each record several lines combining various fields using
IIf statements.

I then have a button to export the report to Word using the standard command
DoCmd.OutputTo acOutputReport, "QryList", acFormatRTF, strfilepath, True, ,
, acExportQualityPrint

It worked....at the beginning and then my users started telling me that
after a while the Word reports starting having errors. The error is always
the same : the first 3 records are generally perfectly replicated in the Word
document but then the first and second line of the 3rd record are repeated in
all the following records.

I first thought it was because my clients use an old version of Word 2000,
however, the same happened in Word 2003 and 2007. I checked their version of
XP and it has SP3....mystery!

I thought it was the IIF statements in the report design view that created
the problem so I transferred them to the underlying report query...still the
same! It happens in Access and runtime mode.

The inexplicable thing is that this problem generally develops over time.
At the beginning all my users were happy and reported no errors. Then it
started doing it sometimes. They then found that by shutting access down and
restarting again, it sorted the problem out. After a while, the problem
seemed to be permanent and was affecting all reports.

I checked for viruses and found nothing.
Any suggestion as what it may be?
Many thanks for your help
S
 
S

Sacapuce

Having investigated the problem, I think I know now where it comes from.
The VBA docmd.output command was originally attached to a command button on
the report in report view mode. I removed the command button and instead ran
the VBA code from a command button on the ribbon. Then it worked!!!

There must be a bug in Access 2007 associated with command buttons on
reports in report view.
S
 

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