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
 

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

Help with DLookup Field 1
dlookup problem 2
Access Query problem 1
If then and Case Select 1
Dlookup and simple calculation 2
Query performance using dlookup 3
dlookup error 2001 1
DLookUp #Error 7

Back
Top