Microsoft KB Archive/296653

= FP2000: Error Querying Date/Time Fields in Access Databases =

Article ID: 296653

Article Last Modified on 6/18/2005

-

APPLIES TO


 * Microsoft FrontPage 2000 Standard Edition

-



This article was previously published under Q296653



For a Microsoft FrontPage 2002 version of this article, see 284843.



SYMPTOMS
When you attempt to search a Microsoft Access database using a date/time field, the following error message appears:

Database Results Error

Description: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

Number: -2147217913 (0x80040E07)

Source: Microsoft OLE DB Provider for ODBC Drivers



CAUSE
The code in the Database Results Wizard that is generated by FrontPage, does not support querying a date/time data type in an Access database.



WORKAROUND
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To work around this behavior and query the date/time field in an Access database, generate the database results region and then modify the code to pass a date/time value. You will need to change the apostrophes to number signs in the SQL SELECT statement. To do this, follow these steps.

NOTE: The following procedure demonstrates how to do this by using the Employees table in the Northwind database. You will need to substitute your database, table, and code for that shown in this procedure.  On the Insert menu, point to Database, and then click Results. Click Use a sample database connection (Northwind), and then click Next. Click Record source. In the Record source list, click Employees. Click Next. Click More Options. In the More Options dialog box, click Criteria. In the Criteria dialog box, click Add.</li> In the Add Criteria dialog box, perform the following: <ol style="list-style-type: lower-alpha;"> In the Field Name list, click HireDate.</li> In the Comparison list, click Equals.</li> In the Value box, type HireDate if it doesn't appear by default.</li> Click OK.</li></ol> </li> Click OK two more times.</li> Click Next two times.</li> Click Finish.</li> After the wizard has finished, click the HTML tab at the bottom of the FrontPage window.</li>  On the Edit menu, click Find. In the Find What box, type the following: s-sql=&quot;SELECT * FROM Employees WHERE (HireDate = '::HireDate::')&quot; </li>  Change each apostrophe (') to a number sign (#), so that it looks similar to this: s-sql=&quot;SELECT * FROM Employees WHERE (HireDate = #::HireDate::#)&quot; </li></ol>

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Additional query words: front page

Keywords: kbbug kbnofix KB296653

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.