Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2007

Tip: Looking for answers? Try searching our database.

Montly Query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
luimms - 08 Nov 2007 17:43 GMT
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
John Spencer - 08 Nov 2007 19:09 GMT
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.

Signature

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

> Hi everyone,
>
[quoted text clipped - 13 lines]
>
> TY
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.