putting queries together

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I have 6 queries that I run each day that ask for todays date and tomorrows
date and then give me a count of activities. Is there a way to combine all 6
into 1 that will give me the information I need?
 
You could create a form with the 2 dates in text boxes and then reference
the form in your query criteria:
Forms![formName]![txtStartDate]

Then behind a button you can call each query one after the other.
 
possibly, but since you haven't given enough information, it is not really
possible to tell.

What does each query do? Can you post the SQL text of your queries?

Have you tried a UNION query?
 
Hello,
I have this 1st query that gives me a total.
SELECT Count(dbo_SR.SRNumber) AS CountOfSRNumber, dbo_SR.OwnerID
FROM dbo_SR
GROUP BY dbo_SR.OwnerID, dbo_SR.Created, dbo_SR.SubgroupID
HAVING (((dbo_SR.Created)>DateAdd("h",8,[start date]) And
(dbo_SR.Created)<DateAdd("h",8,[End Date plus 1 Day])) AND
((dbo_SR.SubgroupID)="2-1a"));

and then I have 4 more that check for increments of time: the one below is
for > 4 and then I have 2 to 24 hours, 24 to 48 hours, 48 to 96 hours and <
96 hours

SELECT dbo_SR.CloseDate, Count(dbo_SR.SRNumber) AS CountOfSRNumber,
dbo_SR.SubgroupID, dbo_SR.CloseDate, dbo_SR.Created AS Expr1,
dbo_SR.SRNumber, dbo_SR.OwnerID
FROM dbo_SR
GROUP BY dbo_SR.CloseDate, dbo_SR.SubgroupID, dbo_SR.CloseDate,
dbo_SR.Created, dbo_SR.SRNumber, dbo_SR.OwnerID
HAVING (((dbo_SR.CloseDate)>DateAdd("h",8,[start date]) And
(dbo_SR.CloseDate)<DateAdd("h",8,[End Date plus 1 Day])) And
((dbo_SR.SubgroupID)="2-1a") And
(DateAdd("h",8,dbo_SR!CloseDate)<DateAdd("h",12,dbo_SR!Created)));

I am trying to set it up so that i only have to enter the dates 1 time and
then be shown the counts for each time period.

Thank you.
 
Back
Top