views:

151

answers:

1

Hello,

I am using the query builder from Visual Studio 2008 to extract data from an Access mdb ( 2003), but I can't make it to work with a datetime field. When I run it with a third party query app I have works fine, but when I try to implement it into visual studio I can't do it.

What is the correct way to extract last month data?

This is what I have:

SELECT 
  [Datos].[ID], [Datos].[E-mail Address], [Datos].[ZIP/Postal Code], [Datos].[Store], [Datos].[date], [Datos].[gender], [Datos].[age]
 FROM 
  [Datos]
 WHERE 
  ([Datos].[date] =<|Last month|>)

Any help is appreciated.

Thank you

A: 

If you want to hardwire it:

where ([Datos].[date] <= #12/31/2009#)

if you want to make it flexible this (might work):

where ([Datos].[date] <= datediff('d',-day(date()),date()))

Oliver Townshend