I'm encountering a problem where DoCmd.OutputTo acOutputQuery
deletes the query itself the second time it is run.
Is there any workaround/patch for this bug (at least seems like a bug to me)?
I'm encountering a problem where DoCmd.OutputTo acOutputQuery
deletes the query itself the second time it is run.
Is there any workaround/patch for this bug (at least seems like a bug to me)?
even 2007 has this problem, it is happening to me also, but very randomly. Sometimes I can run it many times before the bug happens, other times it happens right away, it's a small database, 29 records, and a tiny query, so it's definitely a bug in access
Re: your comment.
Did you do a file copy, or did you copy the objects between two databases? IF the second, you might want to try doing a compact and repair on a file-copy of the original.
You might even want to try that on the real original.
I know it's been awhile since the original post, but I have found a solution that I did not see here. I'm using Access 2010. It seems that almost everytime I execute
DoCmd.OutputTo acOutputQuery...
, my saved query still appears in my list of queries, but the SQL gets wiped out, which subsequently deletes my output file too from the network.I just reset the SQL before calling
DoCmd.OutputTo acOutputQuery...
and then call
So far so good.
it happens to me too. I'm using Access 2003.
The only workaround I've found is to preserve a copy of the original mdb, this way I can restore the mdb when it happens.
It seems that Access 2007 doesn't have this problem.
Another workaround is to change the original query to a make table query, and then use
It means you have an extra table hanging around, but you could always do a delete table in code or via a query afterwards to clean up.
I think the behaviour you described "...deletes the query itself, the second time it is run" occurs when the query returns no records.