• Error 2046 – OutputTo isn’t available now (2003 SP2)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Error 2046 – OutputTo isn’t available now (2003 SP2)

    • This topic has 7 replies, 3 voices, and was last updated 18 years ago.
    Author
    Topic
    #429938

    Hello All, smile

    I’ve recently completed converting my department to Access 2003 and a problem with one of the databases has come up that I can’t seem to fix…

    From the main form, the user clicks the “Send Reports” button… The event procedure uses OutputTo to export 6 reports as .rtf files in a certain folder on the network… It then uses an Outlook Application object to create a new message, attach all files in the folder location and send the email message to one recipient… Simple enough right?… It has worked for years in Access 97 but now that we’ve converted it exports the first report only and then errors out (error 2046)…

    I thought it might have something to do with Access Security because I have implemented customized user groups and permissions, but I ran it logged in as me (full permissions on everything) and it still errors out if I run the sub by clicking the button on the form… However, if I step through the code, it works… ??

    Any idea what’s wrong? Is this a bug with 2003 that I should know about?

    Thanks in advance!

    Viewing 0 reply threads
    Author
    Replies
    • #1002537

      It sounds like a timing problem. You could try inserting a loop that tests whether the .rtf file has been created:

      DoCmd.OutputTo acOutputReport, “rptReport1”, acFormatRTF, “Report1.rtf”
      Do While Dir(“Report1.rtf”) = “”
      DoEvents
      Loop
      DoCmd.OutputTo acOutputReport, “rptReport2”, acFormatRTF, “Report2.rtf”
      Do While …

      • #1002551

        Hi Hans! smile

        Sounded like a great idea, but it didn’t fix the problem… frown Any other ideas?

        • #1002553

          Is the database window hidden in your database? I found a newsgroup post that suggests making the database window visible, based on a suggestion in an MSKB article about a different (but related) problem in Access 2000. Sounds bizarre, but it might be worth a try…

          • #1002566

            That’s good to know! smile I need to learn all the new bugs now!

            BUT… I found the problem… Believe it or not, all I had to do was turn off the Popup property of the main form…. Bizarre yes?…I just happened to have read something last night in the help files about form events and that certain events (activate and deactivate I think) didn’t happen when the Popup property is set to Yes… It just came to mind and I had a thought… Maybe the problem has something to do with events?… Maybe something else is being triggered in between the OutputTo statements (something to do with what’s on the screen and not the code itself)??… If it works when I step through it and not when the user runs it from the form, maybeeeee???… It couldn’t hurt to check it out right?

            I checked the form properties, see that Popup is Yes, change it to No, save the form, close the whole thing down, re-open the database as a normal user (with limited access) and click the button… It works?!?!?

            Have you ever heard of this before? I’ll never understand why it wouldn’t have been a problem in Access 97 and now it is… I seem to find the strangest things sometimes… What’s even more bizarre to me is that I even thought of checking that! laugh

            Thanks for all of your help Hans! It’s much appreciated!

            • #1002593

              Glad you found a solution, and thanks for sharing it – it may help someone else someday.

            • #1051826

              Well here it is almost a year later and I am receiving the same error message on a user machine. (This forum is so useful). Strange thing is yesterday it worked perfectly three times in a row and then failed from then on. Today it worked once and then failed from there. On my machine however it has not failed once. I am also using a pop-up form to activate the code so I am going to look at that along with stepping through the code on the user machine.

            • #1054148

              Strangest thing but finally got the output to work consistently. Making the form normal, that is not a pop-up, did not work consistently, but taking it out of the startup did. The user was content to select and open the form from the database window and then click the button. Then it worked every time.

    Viewing 0 reply threads
    Reply To: Error 2046 – OutputTo isn’t available now (2003 SP2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: