Solved

Need help with DSum syntax

Posted on 2011-03-24
4
415 Views
Last Modified: 2013-11-05
I have a form field using the following calculation...

Me.txtTotThisDayThisCat = (Me.txtQty + Nz(DSum("Qty", "tblProjectDetail", "[CapCat] = '" & Me.txtCapCat & "' And [DropDueDate] = #" & Me.txtDropDueDate & "#"), 0))

This works fine except I need to add one more criteria to the end of the code to EXCLUDE records that have been flagged as complete.  Here is what I have but the calculation is returning the same result as the first line of code.  Can someone see what I'm doing wrong?

Me.txtTotThisDayThisCat = (Me.txtQty + Nz(DSum("Qty", "tblProjectDetail", "[CapCat] = '" & Me.txtCapCat & "' And [DropDueDate] = #" & Me.txtDropDueDate & "#"), 0) And [Complete] = False)

--Steve
0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35206173
I presume you want this:

Me.txtTotThisDayThisCat = (Me.txtQty + Nz(DSum("Qty", "tblProjectDetail", "[CapCat] = '" & Me.txtCapCat & "' And [DropDueDate] = #" & Me.txtDropDueDate & "# And [Complete] = False)"), 0)
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35206210
slight correction, is [complete] a boolean field ?

Me.txtTotThisDayThisCat = (Me.txtQty + Nz(DSum("Qty", "tblProjectDetail", "[CapCat] = '" & Me.txtCapCat & "' And [DropDueDate] = #" & Me.txtDropDueDate & "# And [Complete] = False")), 0)
0
 

Author Comment

by:SteveL13
ID: 35206261
[Complete] is a Yes/No field.  Neither one of the two suggestions removed the records that are complete from the calculation.  ?????
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 35206319
wrong place for the closing ")", try this

Me.txtTotThisDayThisCat = (Me.txtQty + Nz(DSum("Qty", "tblProjectDetail", "[CapCat] = '" & Me.txtCapCat & "' And [DropDueDate] = #" & Me.txtDropDueDate & "# And [Complete] = False"), 0))
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question