Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Help with MS Access query

Posted on 2013-06-20
4
Medium Priority
?
140 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
[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
  • 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

618 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