dlookup and Totals query

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

Guest

Hi
I've build a following query
SELECT qryRoutesAnalisysServiceHistory.Division,
qryRoutesAnalisysServiceHistory.CalendarID,
Count(qryRoutesAnalisysServiceHistory.ID) AS Total,
Count(DLookUp("ID","qryRoutesAnalisysServiceHistory","[MC_Skip]=-1")) AS
Skipped
FROM qryRoutesAnalisysServiceHistory
GROUP BY qryRoutesAnalisysServiceHistory.Division,
qryRoutesAnalisysServiceHistory.CalendarID
ORDER BY qryRoutesAnalisysServiceHistory.CalendarID DESC;

Dlookup is not working. It gives me the same results as Totals column.
I'm just starting with DLookups and I have no idea why this does not work.

Please help
Thanks
Barb
 
It doesn't work cos' your mixing a SQL statement with VB/VBA coding.

Try,

strng = DLookUp("ID","qryRoutesAnalisysServiceHistory","[MC_Skip]=-1")

then, in your SQL string,

.....AS Total, Count(" & strng & ") AS Skipped> FROM ....

Stay cool!

BeWyched
 
o OK, now I understand

thanks
Barb

BeWyched said:
It doesn't work cos' your mixing a SQL statement with VB/VBA coding.

Try,

strng = DLookUp("ID","qryRoutesAnalisysServiceHistory","[MC_Skip]=-1")

then, in your SQL string,

....AS Total, Count(" & strng & ") AS Skipped> FROM ....

Stay cool!

BeWyched




Barb said:
Hi
I've build a following query
SELECT qryRoutesAnalisysServiceHistory.Division,
qryRoutesAnalisysServiceHistory.CalendarID,
Count(qryRoutesAnalisysServiceHistory.ID) AS Total,
Count(DLookUp("ID","qryRoutesAnalisysServiceHistory","[MC_Skip]=-1")) AS
Skipped
FROM qryRoutesAnalisysServiceHistory
GROUP BY qryRoutesAnalisysServiceHistory.Division,
qryRoutesAnalisysServiceHistory.CalendarID
ORDER BY qryRoutesAnalisysServiceHistory.CalendarID DESC;

Dlookup is not working. It gives me the same results as Totals column.
I'm just starting with DLookups and I have no idea why this does not work.

Please help
Thanks
Barb
 
Back
Top