OutputTo causes fatal error

SarahHall

Registered User.
Local time
Today, 18:41
Joined
Jan 15, 2011
Messages
32
Hi super-brains,

I am finding that Access crashes on a line of code and I receieve the "Microsoft Access has encountered a problem and needs to close" type message.

The offending line is:

Code:
    DoCmd.OutputTo acOutputReport, sReportObj, "Biff8", , True

where sReportObj is the user chosen report name.

I have tried substituting each variable to test whether it's something going wrong, but that doesn't seem to make a difference. Worryingly, I've managed to use this code in another Db, so I am starting to worry that thier behaviour pointing towards a corrupt Db.

Looking through other threads on the forum, someone else has encountered the problem. They were exporting to text format however and was able to substitiute OutpputTo with TransferText. I am not able to use TransferSpreadsheet as I am outputting a report and not a table.

Any help greatly appreciated.
 
Check the help file - "Biff8" is not a valid Access output type constant which it is expecting - like acFormatText, acFormatXLS, acFormatRTF, etc.
 
Thanks for your quick reply.

Believe it or not, I've had this format working in another database (it gives the 97-2002 Excel version), but if I try replacing this with acFormatXLS it makes no difference.

I just tried linking tables into a blank database and copying the report across. Incidentally the same thing happens. It really does not make much sense.
 
Thanks for the advice, but decompiling doesn't appear to have worked.
I can successfuly output the file, but the database crashes soon afterwards. I originally thought it could be the AutoStart property being set to True, but setting it to False doesn't seem to make a difference.
I've tried outputting different formats and to different locations and with different PCs, but Access always crashes shortly after outputting.
 
It sounds like you might have some corruption occurring. Have you tried IMPORTING (not copying and pasting) everything into a new, blank database shell? Sometimes when you do that it helps fix things or it helps identify the problem object (because it won't import it, like a specific form or report).
 
Thanks for this suggestion, however doesn't seem to have worked. This error is consistent across different reports, so I am wondering if it is a problem with the data. Very frustrating and confusing.

Thanks again
 
If you feel it is the data, I suggest you make a copy of the data table - structure only. Add one record manually into the new table and use this new table to create the output to. If this fails then most likely you can rule out the data being the source. You may have a rouge record in the table that is affecting the whole procedure.

If it does fail then it could be the table itself. Create a duplicate table from scratch do not copy and paste and retry the above.

Its called trial and elimination.
 
Whilst you're doing what you've been advised I have two questions for you:

1. Does the report have a subreport?
2. Have you tried specifying a file that the output should be read to?

A suggestion would be to recreate your report or test the OutputTo on a brand new report to see if it fails or not. Another thing to try is specifying a different Output Format just to test it.
 

Users who are viewing this thread

Back
Top Bottom