Error on OutputTo


Stephen sjw_ost

I am using the following to save a snapshot of a report.

DoCmd.OutputTo acReport, "IBSIWS_RECON", "SnapshotFormat(*.snp)",
Format(Now, "mmddyy") & ".snp", False, "", 0

When used by itself, it works fine. But when preceded by or followed by a
print command I get the error;

The command or action 'OutputTo' isn't available now

I have tried to put a pause in the code using "Sleep" code, to try any give
the DB time to process but that did not work either.

Does anyone know what might cause this and how to fix?

Thank you for any help

Stephen sjw_ost

I found the answer on another forum;

Just turn the echo off right before your code runs then programatically show
the databasewindow. after your code runs hide the database window and turn
the echo back on:

docmd.echo false
'Show the db window
docmd..SelectObject acTable, , True

'Run code here - all your output to's will work here

'Hide the DB window again
Docmd.SelectObject acTable, , True
Docmd.RunCommand acCmdWindowHide

'turn the echo back on
docmd.echo true

I tried it and it works great

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