Solved

Help with MS Access query

Posted on 2013-06-20
4
129 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 500 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now