After running Export from Access query the query empties itself RRS feed

  • Question

  • Hello,

    I'm facing a weird problem in Access 2010. I have several queries that I sometimes export to both Excel and HTML formats, sometimes when I export, the query empties itself. Meaning, the SQL code disappears from the query and I have to rebuild it before I can use it again.

    Does anyone understand how this can happen?

    Kind regards,

    Rob Demandt

    Monday, January 26, 2015 2:15 PM

All replies

  • Hi Rob,

    Can you supply the SQL code which is being run in Access please?  Also, is the query being called from a macro or any VBA script, if so could you please provide the details on this too?


    Kind regards, Kev

    Monday, January 26, 2015 2:19 PM
  • Dear Kev,

    Sure, the queries are relatively simple, an example:

    "SELECT AC_DEV_01_AUTOPO_NOSOURCE_US50.F1 AS Material, AC_DEV_01_AUTOPO_NOSOURCE_US50.EersteVanF2 AS [Material Description], AC_DEV_01_AUTOPO_NOSOURCE_US50.EersteVanF6 AS Vendor
    WHERE (((AC_DEV_01_AUTOPO_NOSOURCE_US50.EersteVanOpProc)="PJ"));"

    The export is indeed invoked using a MACRO that uses the ExportWithFormatting syntax to export a few queries in a row to XLSX and HTML.

    Kind regards,

    Rob Demandt

    Monday, January 26, 2015 2:24 PM
  • It might also be worth mentioning that the tables in the database are sometimes connected Excel sheets because of various reasons. However, in the past I have had no problems with this setup.
    Monday, January 26, 2015 4:56 PM