Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DSum Error

Status
Not open for further replies.
Mar 12, 2003
678
US
I am running the following Access 2003 query. When I run it i get an #Error code in the runtotal Field. I am trying to create a running total on the amount field by employeeid and by period.

Code:
SELECT dbo_pr_GROSWAGS.Entity, dbo_pr_GROSWAGS.EmployeeId AS empalias, dbo_pr_GROSWAGS.YEAR1, dbo_pr_GROSWAGS.Period, Sum(dbo_pr_GROSWAGS.Amount) AS Amount, DSum("[Amount]","dbo_pr_GROSWAGS","[Employeeid] =" & [Employeeid]) AS runtotal
FROM dbo_pr_GROSWAGS
GROUP BY dbo_pr_GROSWAGS.Entity, dbo_pr_GROSWAGS.EmployeeId, dbo_pr_GROSWAGS.YEAR1, dbo_pr_GROSWAGS.Period
HAVING (((dbo_pr_GROSWAGS.EmployeeId)="016652501") AND ((dbo_pr_GROSWAGS.YEAR1)=2008));
 
If employee id is a text field, it needs to be enclosed in single quotes. Seeing how you already have it hard-coded in the HAVING clause, why not just use SUM? I have to admit I've never used DSum in a query like this, so don't even know if it would work the way you have planned.

"Don't be irreplaceable. If you can't be replaced, you can't be promoted."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top