View Full Version : Date Expression?


pianoprodigy
02-04-2004, 07:31 AM
I need to make the query collect all of records dated one month previous from when the query will be run.

For instance, sometime in February of 2004 the query will be run and return all of the records from January of 2004.

I think this should be easy, but I can't get the syntax right.

Thanks,

Alan

Mile-O
02-04-2004, 07:34 AM
Between DateSerial(Year(DateAdd("m",-1,Date())),Month(DateAdd("m",-1,Date())),1) And DateSerial(Year(Date()),Month(Date()),1)-1

pianoprodigy
02-04-2004, 07:40 AM
Thanks a lot!

DJN
02-04-2004, 08:04 AM
Try

Between DateSerial(Year(Date()),Month(Date())-1,1) And DateSerial(Year(Date()),Month(Date()),0)

David

Mile-O
02-08-2004, 04:54 AM
Originally posted by DJN
DateSerial(Year(Date()),Month(Date())-1,1)

What happens in January? There's no such month as 0. And the year doesn't change...

dan-cat
02-08-2004, 05:14 AM
Originally posted by Mile-O-Phile


What happens in January?

I usually get a big sod-off credit card bill and this year was no exception :rolleyes: