Hi All
Tearing my hair out with this one. My access db front end is based around a navigation form and on lots of the hosted subforms there are command buttons that trigger code that does "lots of stuff" then navigates to a different form. On many of those forms the "lots of stuff" includes using DoCmd.OutputTo to save reports to PDF, and have never encountered any problems. Today I'm working on one of the forms and have inserted a DoCmd.OutputTo part way through the "lots of stuff" and the code now throws "Error '2046': The command or action "BrowseTo" isn't available now" when at the end of the routine I try to navigate to a different form. The DoCmd.OutputTo prior to this works fine.
If I remove the DoCmd.OutputTo line I don't get the error, if I place the DoCmd.OutputTo line after the DoCmd.BrowseTo line I don't get the error (but the report no longer works because I've updated a bunch of records elsewhere in the "lots of stuff" before the DoCmd.BrowseTo). I have experimented with inserting an artificial delay in between the DoCmd.OutputTo and the DoCmd.BrowseTo but this has no effect. I believe I have tried all of the suggestions in this article except OP's bodge of closing then reopening the form:
vba - Access Navigation Control BrowseTo "The command or action 'BrowseTo' isn't available now. Error 2046 - Stack Overflow
I don't have this error message on any of my many other forms that host routines that are doing effectively the same thing. Please throw a drowning man a rope.
Tearing my hair out with this one. My access db front end is based around a navigation form and on lots of the hosted subforms there are command buttons that trigger code that does "lots of stuff" then navigates to a different form. On many of those forms the "lots of stuff" includes using DoCmd.OutputTo to save reports to PDF, and have never encountered any problems. Today I'm working on one of the forms and have inserted a DoCmd.OutputTo part way through the "lots of stuff" and the code now throws "Error '2046': The command or action "BrowseTo" isn't available now" when at the end of the routine I try to navigate to a different form. The DoCmd.OutputTo prior to this works fine.
If I remove the DoCmd.OutputTo line I don't get the error, if I place the DoCmd.OutputTo line after the DoCmd.BrowseTo line I don't get the error (but the report no longer works because I've updated a bunch of records elsewhere in the "lots of stuff" before the DoCmd.BrowseTo). I have experimented with inserting an artificial delay in between the DoCmd.OutputTo and the DoCmd.BrowseTo but this has no effect. I believe I have tried all of the suggestions in this article except OP's bodge of closing then reopening the form:
vba - Access Navigation Control BrowseTo "The command or action 'BrowseTo' isn't available now. Error 2046 - Stack Overflow
I don't have this error message on any of my many other forms that host routines that are doing effectively the same thing. Please throw a drowning man a rope.