OutputTo Runtime Error '2046' (1 Viewer)

C

ccool

Guest
I currently have a database that is running code that is hiding the database window when it is being run.

On the close trigger for my form I'm tring to output two reports:

Filename = ".\OldBooks.SNP"
DoCmd.OutputTo acOutputReport, "rOldBooks", acFormatSNP, Filename, False

Filename = ".\testReport.SNP"
DoCmd.OutputTo acOutputReport, "rBarCodeList_2Col", acFormatSNP, Filename, False

What is happening is the first report is outputting but the second one is not. When I run the debugger when the program tries to run the second OutputTo I am getting the following error message:

Runtime error '2046'

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


I have tried switching the order of the DoCmd's and have recieved the same result

Any idea to why I may be getting this message, what it may means or how to correct it?
 

Curry

Registered User.
Local time
Today, 09:55
Joined
Jul 21, 2003
Messages
73
Hi there,

I am having the same problem as you have indicated...I noticed that you did not get any replies....Did you mange to find a work around...?

Any help would be most appreciated

Curry...
 

Curry

Registered User.
Local time
Today, 09:55
Joined
Jul 21, 2003
Messages
73
Hi there,

I found a solution to this problem. Thought you might be interested...

In between each

DoCmd.OutputTo acOutputReport, "rOldBooks", acFormatSNP, Filename, False

you need to set the focus back to the form that is running the code

ie

DoCmd.OutputTo acOutputReport, "rOldBooks", acFormatSNP, Filename, False

me.Form.Setfocus

DoCmd.OutputTo acOutputReport, "rBarCodeList_2Col", acFormatSNP,_ Filename, False

The error will no longer occur.

Hope this helps you out.

Curry
 

Users who are viewing this thread

Top Bottom