I am using the following code to export query results to Excel.
DoCmd.OutputTo acOutputQuery, "QueryName", "ExcelWorkbook(*.xlsx)", strFileName & ".xlsx", True, , , acExportQualityScreen
This command is intermittently erasing the query contents (the stored query remains in the database however is empty)
?!?
Query is pretty basic / essentially as follows;
SELECT
FROM
WHERE (Value Criteria, Form Reference Criteria - combination of ANDs and ORs)
GROUP BY
Don't think it matters but on the same form that is calling this acOutputQuery command, I have a field with its control source being set to:
......ControlSource = "=" & DCount("*", "QueryName")
I have no idea why its occurring, debugging and code watching isn't showing me why its happening.
?!?