WD: Errors When Querying on Data with Straight Quote/Apostrophe

Last reviewed: February 4, 1998
Article ID: Q125414
The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows 95, versions 7.0, 7.0a
  • Microsoft Word 97 for Windows
  • Microsoft Word for the Macintosh, versions 6.0, 6.0.1, 6.0.1a

SYMPTOMS

When you attempt to query a data source in which a data record contains an apostrophe, you may receive one of the following error messages.

Word Data Source or Microsoft Excel Spreadsheet

Using DDE or Converter (Windows and Macintosh)

   Word could not parse your query options into a valid SQL String.

Microsoft Access Data Source Using ODBC (Windows Only)

   Open Database Connectivity Error - 10014 in query expression ".

     (Details button)

     - ODBC Error: [Microsoft][ODBC Access Driver]10014 in query
       expression ".
       Error. Sql State: 37000.
       Return Code: SQL_ERROR

Microsoft Access data Source Using DDE (Windows Only)

   Word could not re-establish a DDE connection to Microsoft
   Access to complete the current task.

FoxPro data source using ODBC (Windows)

   Open Database Connectivity Error - Syntax Error.

     (Details button)
     - ODBC Error: [Microsoft][ODBC Single-Tier Driver]Syntax
       Error.
       Sql State: 37000.
       Return Code: SQL_ERROR
     - SELECT *FROM <database file> WHERE
       (("<Fieldname>"='O'Neil'<<???>>>))

CAUSE

The Word for Windows SQL query engine does not recognize a "straight" quotation mark or a "straight" apostrophe (as opposed to smart quotes, or curly quotation marks) as a valid SQL or query string. The above errors do not occur when using MS Query.

WORKAROUND

Method 1

Use smart quotes. To do this, follow these steps:

  1. If you have not created your Word data source, do the following:

          a. Turn on Smart Quotes. On the Tools menu, click AutoCorrect, then
    
             click the "Change 'Straight Quotes' to 'Smart Quotes'" option.
       
          b. Type in the data using smart quotes.
       
          c. Copy the data to the Clipboard.
       
          d. Start the query.
       
          e. In the Filter dialog box, paste the Clipboard contents into the
             Compare To box.
    
    

  2. If you have an existing data source, use the AutoFormat command to replace straight quotes with smart quotes:

          a. Open your data source.
    

          b. On the Format menu, click AutoFormat.
    

          c. Click the Options button. Under Replace, select the "Straight
    
             Quotes with Smart Quotes" check box, clear any other check boxes,
             and click OK.
       
          d. Click OK.
       
          e. Click Accept.
       
          f. Perform your query.
    
    

Method 2

Use MS Query. For applications like Fox Pro and Microsoft Access using ODBC, you may have the option to use MS Query if you have Microsoft Excel 5.0 installed. Click the option to use MS Query instead of the internal query engine in Word.

STATUS

We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Additional query words: merge data error message errmsg odbc sql query
filter sort
Keywords : kbmerge macword winword word6 word7 word95 kberrmsg kbinterop
Version : WINDOWS:6.0,6.0a,6.0c,7.0,7.0a,97;MACINTOSH:6.0,6.0.1,6.0.1a
Platform : MACINTOSH WINDOWS
Issue type : kbbug kbhowto


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: February 4, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.