Date fields in SQL query

L

Leif S

Hi,

I run into problems when I try to use a date field from an Access 2003 form
as part of an SQL query. When I write:

<recordsetName>.Open SELECT <fieldlist> WHERE <date-column-in-table>
Me.<datefield-in-form>

An error is raised indicating that the date column (SQL) and the date
field(Access) cannot be evaluated.

There must be a way toconvert both to a common format so that the evaluation
can be performed. Have any of you a solution for this?

Leif S.
 
O

Ofer Cohen

Try

<recordsetName>.Open "SELECT FieldName WHERE DateFieldName = " &
Format(Me.<datefield-in-form>, "\#mm\/dd\/yyyy\#")
 
L

Leif S

Thanks Ofer. I minor change was necessary: "mm\/dd\/yyyy" then it worked fine!

Case closed.
 
Top