XL97: Query Is Not Executed in the Background

Last reviewed: January 15, 1998
Article ID: Q161759
The information in this article applies to:
  • Microsoft Excel 97 for Windows

SYMPTOMS

When you run a query in Microsoft Query, the query is not run in the background (asynchronously).

CAUSE

This problem occurs when one of the following conditions is true:

  • The Open Database Connectivity (ODBC) driver you use to create the query does not support asynchronous queries.

        -or-
    
  • You record or run a macro while the query is executing.

        -or-
    
  • You do not save the query definition with the worksheet.

RESOLUTION

To run your query asynchronously, use the appropriate method:

  • Ensure that the ODBC driver you use to create the query supports asynchronous queries.

    -or-

- Do not record or run a macro while the query is executing.

   -or-

  • Save the query definition with the worksheet.

    NOTE: When you create a new query in Microsoft Excel 97, the query is saved with the worksheet by default. Clearing the Save Query Definition check box in the "External Data Range Properties" dialog box permanently removes the query definition from the workbook. If you do not save the query definition with the worksheet, you cannot execute asynchronous queries.

    MORE INFORMATION

    Asynchronous Queries

    Microsoft Excel 97 can execute a query in the background, or asynchronously. Microsoft Excel 97 can execute a query and get data asynchronously with ODBC drivers that support asynchronous behavior. All Microsoft ODBC 3.0 drivers support asynchronous executions. Asynchronous execution runs the query in the background so that control is returned to Microsoft Excel while the external data is retrieved.

    Earlier versions of Microsoft Excel use synchronous queries only. With synchronous queries, you cannot run the query in the background, and the query must be finished before control is returned to Microsoft Excel.

    Saving Query Definitions and Enabling Background Refresh

    After you select the option to return data to Microsoft Excel from Microsoft Query or the Query Wizard, the "Returning External Data to Microsoft Excel" dialog box appears. In this dialog box, click Properties. The "External Data Range Properties" dialog box appears. To enable background refresh, check both the Save Query Definition check box and the Enable Background Refresh check box. (Both of these options are checked by default.)

    After the data is returned to Microsoft Excel, if you saved the query definition with the worksheet, you may access the properties for the external data range. To do this, use the following steps:

    1. Select a cell in the data range that contains the results of the query.

    2. On the Data menu, point to Get External Data and click Data Range Properties.

    Clearing the Save Query Definition check box after the query returns data to the workbook permanently removes the query definition from the worksheet, but the query results remain. If you clear the Save Query Definition check box and click OK, you are unable to refresh the query or change the data range properties.

    For more information about executing background queries while a macro runs, please see the following article in the Microsoft Knowledge Base:

         TITLE     : XL97: Background Queries Suspended While Macro Executes
         ARTICLE-ID: Q157090
    
    

    REFERENCES

    For more information about running background queries, click the Index tab in Microsoft Excel Help, type the following text

       queries, background
    
    
    and then double-click the selected text to go to the "Run a query in the background or while you wait" topic.


  • Additional query words: XL97 async query asynch query msquery
    Keywords : xlquery kbinterop kbualink97
    Version : WINDOWS:97
    Platform : WINDOWS


    THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

    Last reviewed: January 15, 1998
    © 1998 Microsoft Corporation. All rights reserved. Terms of Use.