## Error Using Date Field in Database Query Using ODBC

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#))

Additional query words: 6.0 b_waccess foxpro access word6 6.0a 6.0c winword

Keywords :
Issue type :
Technology :

Last Reviewed: November 4, 2000 © 2001 Microsoft Corporation. All rights reserved. Terms of Use.