F Floyd Forbes Jan 31, 2005 #1 Hi, How do you only show the last twelve months in a query expression? Floyd
M [MVP] S.Clark Jan 31, 2005 #2 SELECT * FROM tablename WHERE somedatefield Between Date()-365 And Date(). DateAdd, DateDiff, DatePart, Month, and Format can assist as well.
SELECT * FROM tablename WHERE somedatefield Between Date()-365 And Date(). DateAdd, DateDiff, DatePart, Month, and Format can assist as well.
J John Vinson Jan 31, 2005 #3 Hi, How do you only show the last twelve months in a query expression? Floyd Click to expand... Use a criterion of BETWEEN DateAdd("m", -12, Date()) AND Date() This will give you the past twelve months to the day - that is, if it's run on January 19 2005, it will give you all records from midnight, January 19, 2004 up to midnight at the beginning of January 19, 2005. John W. Vinson[MVP]
Hi, How do you only show the last twelve months in a query expression? Floyd Click to expand... Use a criterion of BETWEEN DateAdd("m", -12, Date()) AND Date() This will give you the past twelve months to the day - that is, if it's run on January 19 2005, it will give you all records from midnight, January 19, 2004 up to midnight at the beginning of January 19, 2005. John W. Vinson[MVP]