Solved

Microsoft Access 2013 Report Grouping levels need to count unique records

Posted on 2014-11-14
7
265 Views
Last Modified: 2014-11-18
I have a report almost complete. I track request from various sources. The database tracks the time spent on each request. dbreqid is the key field and the request has multiple entries for documenting time. When I do a group by requester and count the number of request it counts for each of my time records. One request will have multiple time records. How do I count just the distinct records in the dbreqid field. I have group level for the source but it counts each individual time record not each dbreqid. I tried to group on dbreqid but that doesn't work either. Thanks for the help.
0
Comment
Question by:marlind605
  • 3
  • 3
7 Comments
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 40442753
You'll have to use a subquery, something like this:

Select
    T.Source,
    T.Requester,
    T.TotalTime,
    Count(*) As Requests
From
    (Select Source, Requester, Sum(TimeSpent) As TotalTime From tblTable Group By Source, Requester) As T
Group By
    T.Source,
    T.Requester,
    T.TotalTime

This should give you the clean figures.
In your report, however, you would do the grouping and counting, Thus it should use the subquery above as source.

/gustav
0
 
LVL 35

Expert Comment

by:PatHartman
ID: 40442759
You may need to break the report into a main report with a subreport.  That will allow you to count records separately for each recordset.
0
 

Author Comment

by:marlind605
ID: 40443585
I am looking at the two answers. Thanks.
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:marlind605
ID: 40448803
Still not getting this. Tried subreports and different queries. Any other help?
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40449329
That's hard without knowing what you did try.

/gustav
0
 

Author Closing Comment

by:marlind605
ID: 40449899
What I ended up doing was creating two make table queries one to show each request by organization and the other created from the first result to show count by organization and request and then used the added the query to the one I was using for the report. It is not the way I wanted to go but seems to run quick and is accurate. There may be another solution but I couldn't figure it out. Thanks for all the replies.
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40449938
OK, thanks for the feedback.

/gustav
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

803 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