Solved

How count records in each month from current month going back 12 months

Posted on 2016-11-21
4
52 Views
Last Modified: 2016-11-22
I have a table that has a field for RecordID and a field for DateEntered.  And then I am going to have a form where the user will enter a date range, for example, 12/1/2015 through 11/30/2016 (two date fields to be entered).

And then I want to have a report that shows the record counts for each month.  Something like the attached report result.

But I don't know how to query the data and how to make the labels, (example: "December, 2015") get populated.

Any help much appreciated.
ReportExample.jpg
0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 41896643
Do you want to count the months for date entered? I.e. count all records entered in each month/year?
If yes try
SELECT Count(table1.id) AS CountOfid, Format([date entered],'mmm/yyyy') AS DateEntered
FROM table1
GROUP BY Format([date entered],'mmm/yyyy');
0
 
LVL 20

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 125 total points
ID: 41896704
These EE video tutorial explains how to setup a report and group by parts of a date.  

Create a Query and Grouped Report and Modify Design using Access
https://www.experts-exchange.com/videos/4514/Create-a-Query-and-Grouped-Report-and-Modify-Design-using-Access.html

Polish Reports in Access
https://www.experts-exchange.com/videos/4559/Polish-Reports-in-Access.html

Perhaps what you want to do is put the detail in the Detail section and set visible to No. Then show the totals that you really want to see in a group section.
0
 
LVL 50

Accepted Solution

by:
Gustav Brock earned 250 total points
ID: 41897340
You can use a query like this:
PARAMETERS 
    [Forms]![DateSelect]![StartDate] DateTime, 
    [Forms]![DateSelect]![EndDate] DateTime;
SELECT 
    Format([DateEntered],"yyyy/mm") AS YearMonth, 
    Format([DateEntered],"mmmm"", ""yyyy") AS MonthLabel, 
    Count(*) AS RecordCount
FROM 
    DateItems
WHERE 
    DateItems.DateEntered Between [Forms]![DateSelect]![StartDate] And [Forms]![DateSelect]![EndDate]
GROUP BY Format([DateEntered],"yyyy/mm"), Format([DateEntered],"mmmm"", ""yyyy");

Open in new window

Then, in the report, sort on YearMonth.

See the attached demo.

/gustav
Report.accdb
0
 
LVL 7

Assisted Solution

by:COACHMAN99
COACHMAN99 earned 125 total points
ID: 41897796
Create a query as follows, then a report, designed on the query

SELECT Count(table1.id) AS CountOfid, Format([date entered],'mmm/yyyy') AS DateEntered
FROM table1
WHERE (((table1.[Date Entered])>=[Forms]![Form1]![FromDate]) AND ((table1.[Date Entered])<=[Forms]![Form1]![ToDate]))
GROUP BY Format([date entered],'mmm/yyyy')
ORDER BY Format([date entered],'mmm/yyyy');
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question