Montly Query

  • Thread starter Thread starter luimms via AccessMonster.com
  • Start date Start date
L

luimms via AccessMonster.com

Hi everyone,

I need your help in constructing a query that reads the data field in the
table, so it only returns the dates asked.

What i need now (and i hope to start gainning enough knowhow to do it miself)
it to bild a query (12 of them) for 1 month.

January of instance, displaying all the entries betwen 01-01-2007 and 31-01-
2007.

This should be simple, but iam still learning, so sorry for being a noob ;D

TY
 
How about one query where you specify the date range?

In the criteria "cell" under your Date fields enter the following.

Between DateSerial([Enter Year Number],[Enter Month Number],1) and
DateSerial([Enter Year Number],[Enter Month Number]+1,1-1)

Make sure you spell Enter Year Number and Enter Month Number the same in
both places.
When you run the query it will ask you for a Year number and a month number
and then will construct the dates using the DateSerial function.

Explanation of DateSerial
DateSerial needs a year number, month number and day number to create a
date.

To get the last day of the month we've used a bit of "magic". The last day
of the month is also the zero day of the next month (Day 1 minus 1 = 0), so
we've added one to the month (+1) and then subtracted 1 (1-1 = 0) day.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Back
Top