?
Solved

Help with MS Access query

Posted on 2013-06-20
4
Medium Priority
?
141 Views
Last Modified: 2013-11-19
I need a query that delineates new records that have been added for each month.  The records have a unique ID.  The update month is also a field. Please see the example data database and the desired results (excel)

Any Takers!
TestMDB.accdb
Example.xlsx
0
Comment
Question by:Thomask23
  • 2
  • 2
4 Comments
 
LVL 24

Expert Comment

by:Bitsqueezer
ID: 39264262
Hi,

maybe this query is what you want:

TRANSFORM Count([Sample Table].[ID]) AS AnzahlvonID
SELECT 'Count Of Dates' AS [Count of Dates], Count([Sample Table].[ID]) AS [Count of all]
FROM [Sample Table]
GROUP BY 'Count Of Dates'
PIVOT Format([Update Date],"Short Date");

Open in new window


You can of course also group that by "Data":

TRANSFORM Count([Sample Table].ID) AS AnzahlvonID
SELECT [Sample Table].Data, Count([Sample Table].ID) AS [Count of all]
FROM [Sample Table]
GROUP BY [Sample Table].Data
PIVOT Format([Update Date],"Short Date");

Open in new window


Cheers,

Christian
0
 

Author Comment

by:Thomask23
ID: 39265740
Almost...

The records are identified as new by the ID. If a new id is updated to the data it should only be count it. I want to count the only the new records added by the updated date.
0
 
LVL 24

Accepted Solution

by:
Bitsqueezer earned 2000 total points
ID: 39267402
Hi,

that was not clear from your example and to be exact, it is not clear from what you wrote now.

You can create a query like this to get the newest ID of each date if that is what you want:

SELECT [Sample Table].[Update Date], Max([Sample Table].ID) AS MaxvonID
FROM [Sample Table]
GROUP BY [Sample Table].[Update Date];

Open in new window


You see that any date value always only have one ID and so the result of a count in a further query would always be 1.

(That can also be transformed like in the example above but normally it's better to create normal queries than crosstab queries as these have a limitation of 255 columns.)

If that's not what you thought of then please be more exact.

A "new ID" cannot be "updated", only inserted.

Cheers,

Christian
0
 

Author Comment

by:Thomask23
ID: 39659432
Thanks
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

850 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