Error on OutputTo

  • Thread starter Thread starter Stephen sjw_ost
  • Start date Start date
S

Stephen sjw_ost

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

DoCmd.OutputTo acReport, "IBSIWS_RECON", "SnapshotFormat(*.snp)",
"G:\OST\RECONDATABASE\ReconArchive\IBSIWS\" & "JAX_IBSIWS_RECON_" &
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
 
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
Stephen
 
Back
Top