Link to home
Start Free TrialLog in
Avatar of J.R. Sitman
J.R. SitmanFlag for United States of America

asked on

Need Access query modified

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
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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

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
Avatar of J.R. Sitman

ASKER

I'm at Sushi bar having Sake.  Ill ck later if I can.  :)
Both of the solutions worked, but I'm accepting this one because it came in first.

Thanks
Glad to help :-)