Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time error '2046' on OutputTo

Status
Not open for further replies.

scmroddy

Programmer
Jul 23, 2001
3
0
0
US
I am automatically opening an mdb and outputting both a query and a report to the local machine. It seems I can only automate 1 OutputTo action. Whenever I try both (in either order, or the same one twice) it returns:

Run-time error '2046'

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

Thanks in advance!
 
Just a guess, but is it possible the two 'output to' commands are attempting, but failing to, run concurrently?

If that's the case, I'm not sure of a bulletproof way to tell the output to is complete. One method might be to put the second 'output to' command in a loop (with a DoEvent), and k
 
Sorry, I truncated the previous response... (stored it in notepad after the server hung up, then pasted it back incorrectly)


Just a guess, but is it possible the two 'output to' commands are attempting, but failing to, run concurrently?

If that's the case, I'm not sure of a bulletproof way to tell the output to is complete. One method might be to put the second 'output to' command in a loop (with a DoEvent), and keep trying until the error doesn't occur.
 
Thanks, but I'm not really familiar with DoEvents, so I can't seem to get it to work. Maybe a little more info will help -

The automation actually works fine when it's executed while Access is already open (through OnLoad or OnClick events), but when I open the db through a Scheduled Task, it returns this error.
 
Well a work-around I found is to simply open the form before the OutputTo, and close it once complete.

Can't guess exactly why it works though. Something to do with the modules being loaded I guess.
 
That makes it too easy. However, it does work. I thought it a conflict between a timer_interval in my automatic database shutdown in the event that the user did not use the db for 30 minutes. The funny thing is that it works (without opening and closing) in design mode where you override autoexec macro and db settings (pressing shift). Nonetheless, my quest has subsided until I reinvent the urge to find out why my subsequent instances of OutputTo can't be done. Thanks for the tip.

Myk
 
Application.Echo False

code to open
code to output
code to output (cont)
code to close

Application.Echo True

... and they won't know you took the easy way. Happy OutputTo-ing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top