Results 1 to 8 of 8
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error 2046 - OutputTo isn't available now (2003 SP2)

    Hello All, <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    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!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error 2046 - OutputTo isn't available now (2003 SP2)

    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 ...
    ...

  3. #3
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error 2046 - OutputTo isn't available now (2003 SP2)

    Hi Hans! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    Sounded like a great idea, but it didn't fix the problem... <img src=/S/frown.gif border=0 alt=frown width=15 height=15> Any other ideas?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error 2046 - OutputTo isn't available now (2003 SP2)

    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...

  5. #5
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error 2046 - OutputTo isn't available now (2003 SP2)

    That's good to know! <img src=/S/smile.gif border=0 alt=smile width=15 height=15> 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! <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>

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

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error 2046 - OutputTo isn't available now (2003 SP2)

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

  7. #7
    3 Star Lounger
    Join Date
    Mar 2006
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    289
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Error 2046 - OutputTo isn't available now (2003 SP2)

    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.
    Thanks
    chuck

  8. #8
    3 Star Lounger
    Join Date
    Mar 2006
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    289
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Error 2046 - OutputTo isn't available now (2003 SP2)

    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.
    Thanks
    chuck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •