DSum Problem

D

DS

I have a Query. I'm trying to run a DSum() from it and I keep getting an
error. What is the correct Syntax here?

SELECT tblCheckDetails.CDItemID, Sum(tblCheckDetails.CDQuantity) AS
SumOfCDQuantity, tblItems.ItemName, tblCheckDetails.CDPrice,
Sum([CDQuantity]*[CDPrice]) AS EXT, tblCheckDetails.CDReportID,
tblReportCats.ReportCatName
FROM ((QueryDates INNER JOIN tblCheckDetails ON QueryDates.CDBizDay =
tblCheckDetails.CDBizDay) INNER JOIN tblItems ON tblCheckDetails.CDItemID =
tblItems.ItemID) INNER JOIN tblReportCats ON tblCheckDetails.CDReportID =
tblReportCats.ReportCatID
GROUP BY tblCheckDetails.CDItemID, tblItems.ItemName,
tblCheckDetails.CDPrice, tblCheckDetails.CDReportID,
tblReportCats.ReportCatName;

DSum("EXT","Query2",CDReportID = " & Report!rptQty!CDReportID)

Thanks
DS
 
D

Douglas J. Steele

What's the data type of CDReportID? If it's text, you need quotes around the
value you're passing:

DSum("EXT","Query2",CDReportID = '" & Report!rptQty!CDReportID & "'")

Exagerated for clarity, that's

DSum("EXT","Query2",CDReportID = ' " & Report!rptQty!CDReportID & " ' ")

If that's not the issue, what's the error you're getting?
 
D

DS

Thanks Douglas,
So it seems that it wasn't a coding issue but a timing isuue with the
frmReportDates form. Problem solved.
Thank you.
DS
 

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

ListBox Rowsource 2
SQL Rowsource 1
OPEN ARGS Trouble 2
Crosstab Query Fields 2
Sub-Query Problem 8
DSum Problem 2
SQL ORDER BY 1
Not returning a value 8

Top