all values prior to certain date

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

Guest

I'm trying to put together a query that will search my db for records where
the date field has values prior to the end of the preceding month. e.g. if
I'm querying data today (10/25/04), I want all records that have the date of
09/30/04 and earlier. No matter what day I run the query, I want the end of
the preceding month.

I hope this is enough information.

tia,
 
SELECT *
FROM [YourTable]
WHERE DateField < DateSerial(Year(Date()), Month(Date()), 1)
 
I'm trying to put together a query that will search my db for records where
the date field has values prior to the end of the preceding month. e.g. if
I'm querying data today (10/25/04), I want all records that have the date of
09/30/04 and earlier. No matter what day I run the query, I want the end of
the preceding month.

I hope this is enough information.

tia,

Where YourTable.DateField <=DateSerial(Year(Date()),Month(Date()),0)
 
Thank you both! They both work just fine.

Van T. Dinh said:
SELECT *
FROM [YourTable]
WHERE DateField < DateSerial(Year(Date()), Month(Date()), 1)

--
HTH
Van T. Dinh
MVP (Access)




JMorrell said:
I'm trying to put together a query that will search my db for records where
the date field has values prior to the end of the preceding month. e.g. if
I'm querying data today (10/25/04), I want all records that have the date of
09/30/04 and earlier. No matter what day I run the query, I want the end of
the preceding month.

I hope this is enough information.

tia,
 
Back
Top