Error Using Date Field in Database Query Using ODBC

Last reviewed: February 5, 1998
Article ID: Q110215
The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c

SYMPTOMS

In Word version 6.0 for Windows, an error message or an incorrect date formats generated when you specify a date/time field as part of a database query using ODBC.

CAUSE

Word passes dates and times to the ODBC drivers in an incorrect format.

STATUS

Microsoft has confirmed this to be a problem in Word for Windows versions 6.0, 6.0a, and 6.0c. This problem was corrected in Word version 7.0 for Windows 95.

WORKAROUND

To work around this problem:

  • Use Microsoft Query, a tool provided with Excel 5.0, to perform the query.
  • Insert the entire database table into a Word document, save it as a Word document, and then use that document as a data source. You can then perform a query that contains a date field.
  • If the database file is from an application that supports DDE, and the database application is on the system, you may be able to use DDE, rather than ODBC to query the database. For example, you can use DDE with Microsoft Access database files.

MORE INFORMATION

Example of Problem and Error Message

You want to retrieve customer orders placed in 1994. When you choose Query Options from either Insert Database or Tools Mail Merge and specify to retrieve records where OrderDate is greater than 12/31/93, you receive an ODBC error message similar to the following:

   ODBC ERROR:
   Stop -- Syntax Error

Choosing OK results in:

   ODBC ERROR
   Stop -- SELECT "OrderDate", "OrderID" FROM "ORDERS" WHERE (("OrderDate"
   > #12<<???>>/31/93#))

Choosing Details results in:

   ODBC ERROR:[Microsoft][ODBC Single-Tier Driver]
   Stop -- SELECT "OrderDate","OrderID" FROM "ORDERS" WHERE (("OrderDate" >
   #12<<???>>/31/93#))


KBCategory: kbusage buglist6.0 buglist6.0a buglist6.0c fixlist7.0
KBSubcategory:
Additional query words: 6.0 b_waccess foxpro access word6
6.0a 6.0c winword
Version : 6.0 6.0a 6.0c
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: February 5, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.