Union Query

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

Guest

I hope some one can help me i have this folling query and it gives me the
correct count for Record No for the month 1 and 2 but when it does the Dcount
for Elapse Time it gives only the count for Month 1 and for Month 2 it gives
me the exact ones as for Month 1 and not the ones for Month 2, could sone one
tell me what i am doing wrong

Regards Markus

SELECT Count([Record No]) AS [RecordNo], Dcount("[Elapse time required to
resolve]","New All Query","[Elapse time required to resolve]='Less Then 24
Hours'") AS [Elapsetime Less then 24 Hours]
FROM [New All Query]
Having (((Month([Date of Call]))=1));
Union All SELECT Count([Record No]) AS [RecordNo], DCount("[Elapse time
required to resolve]","New All Query","[Elapse time required to
resolve]='Less Then 24 Hours'") AS [Elapsetime Less then 24 Hours]
FROM [New All Query]
Having (((Month([Date of Call]))=2));
 
You need to move your Having clause into the DCount as a WHERE clause:

...."[Elapse time required to resolve]='Less Then 24 Hours' AND [Date of
Call]=1"

and

...."[Elapse time required to resolve]='Less Then 24 Hours' AND [Date of
Call]=2"

Otherwise, nothing differentiates the two DCount calls and you'll get the
same value for both calls.

Carl Rapson
 
Back
Top