Date fields in SQL query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
Try

<recordsetName>.Open "SELECT FieldName WHERE DateFieldName = " &
Format(Me.<datefield-in-form>, "\#mm\/dd\/yyyy\#")
 
Thanks Ofer. I minor change was necessary: "mm\/dd\/yyyy" then it worked fine!

Case closed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top