dlookup and Totals query

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
 
G

Guest

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

dlookup error 2001 1
using dlookup in a query 2
Dlookup or Dcount 4
DLookUp #Error 7
totals for multiple fields 1
Access Query problem 1
Type Mismatch in dLookup 9
dynamic crosstab report with groupfooter totals 1

Top