Solved

Need Access query modified

Posted on 2012-12-21
6
275 Views
Last Modified: 2012-12-22
Can someone modify this query to have it group by location and not prompt for the location?

Points are high because I need this by tomorrow

Select Count(A.SoftSlip), A.Species
From
(
SELECT Notes.SoftSlip, Species.Species
FROM Species INNER JOIN (Notes INNER JOIN SoftSlips ON Notes.SoftSlip = SoftSlips.SoftSlip) ON Species.SpeciesID = SoftSlips.SpeciesID
WHERE (((Notes.NoteDate) Between [forms]![frmSwitchboard]![txtStartDate] And [forms]![frmSwitchboard]![txtEndDate]) AND ((SoftSlips.Location) Like "*" & [Enter Location] & "*") AND ((Notes.NoteType)="Trainer"))
GROUP BY Species.Species,Notes.SoftSlip
) As A
Group by A.Species
0
Comment
Question by:jrsitman
  • 3
  • 2
6 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 38714837
Give this a try:


Select Count(A.SoftSlip), A.Location, A.Species
From
(
SELECT Notes.SoftSlip, Species.Species, SoftSlips.Location
FROM Species INNER JOIN (Notes INNER JOIN SoftSlips ON Notes.SoftSlip = SoftSlips.SoftSlip) ON Species.SpeciesID = SoftSlips.SpeciesID
WHERE (Notes.NoteDate Between [forms]![frmSwitchboard]![txtStartDate] And [forms]![frmSwitchboard]![txtEndDate])  AND (Notes.NoteType ="Trainer")
GROUP BY SoftSlips.Location, Species.Species,Notes.SoftSlip
) As A
Group by A.Location, A.Species

Open in new window

0
 
LVL 61

Expert Comment

by:mbizup
ID: 38714842
The above will group by location and species.  If you want to omit the grouping by species:

Select Count(A.SoftSlip), A.Location
From
(
SELECT Notes.SoftSlip, Species.Species, SoftSlips.Location
FROM Species INNER JOIN (Notes INNER JOIN SoftSlips ON Notes.SoftSlip = SoftSlips.SoftSlip) ON Species.SpeciesID = SoftSlips.SpeciesID
WHERE (Notes.NoteDate Between [forms]![frmSwitchboard]![txtStartDate] And [forms]![frmSwitchboard]![txtEndDate])  AND (Notes.NoteType ="Trainer")
ORDER BY SoftSlips.Location, Species.Species,Notes.SoftSlip
) As A
Group by A.Location

Open in new window

0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 38714843
do you mean like this

Select Count(A.SoftSlip), A.Species, A.Location
From
(
SELECT Notes.SoftSlip, Species.Species,SoftSlips.Location
FROM Species INNER JOIN (Notes INNER JOIN SoftSlips ON Notes.SoftSlip = SoftSlips.SoftSlip) ON Species.SpeciesID = SoftSlips.SpeciesID
WHERE (((Notes.NoteDate) Between [forms]![frmSwitchboard]![txtStartDate] And [forms]![frmSwitchboard]![txtEndDate]) AND ((Notes.NoteType)="Trainer"))
GROUP BY Species.Species,Notes.SoftSlip,SoftSlips.Location
) As A
Group by A.Species,A.Location
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:jrsitman
ID: 38714860
I'm at Sushi bar having Sake.  Ill ck later if I can.  :)
0
 

Author Closing Comment

by:jrsitman
ID: 38714978
Both of the solutions worked, but I'm accepting this one because it came in first.

Thanks
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38715465
Glad to help :-)
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

863 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

19 Experts available now in Live!

Get 1:1 Help Now