In an access Query how do you get data for the current month

D

Dram

I would like to extract data for the current month only from my data base
based on a receipt date. formated as mm/dd/yyyy I can get todays stuff and
last months stuff but simply can't get the current month.
 
R

raskew via AccessMonster.com

Try this in the criteria cell of your date field:

between dateserial(Year(Date), month(Date), 1) and dateserial(Year(Date),
month(Date)+ 1, 0)
 
K

KARL DEWEY

Open your query in design view, scroll to the right to find a blank column
and enter this in the Field row of the grid -- Last_Month: Format([receipt
date], "yyyymm")
Below in the Criteria row enter -- Format(DateAdd("m",-1,Date()),"yyyymm")
 
D

Dram

As written this returned the previous months data, but it gave me a starting
point. by changing the -1 to a 0 it returned the curent months data. So thank
you very much it was exactly what I needed and is very much appreciated.

KARL DEWEY said:
Open your query in design view, scroll to the right to find a blank column
and enter this in the Field row of the grid -- Last_Month: Format([receipt
date], "yyyymm")
Below in the Criteria row enter -- Format(DateAdd("m",-1,Date()),"yyyymm")

--
KARL DEWEY
Build a little - Test a little


Dram said:
I would like to extract data for the current month only from my data base
based on a receipt date. formated as mm/dd/yyyy I can get todays stuff and
last months stuff but simply can't get the current month.
 
Top