Solved

Need help with DSum syntax

Posted on 2011-03-24
4
398 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
  • 2
4 Comments
 
LVL 142

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Normalization of a table 19 75
Why can't I update my query in datasheet view (or my form). 6 21
Access check if a table is open 4 44
Filter a form 8 16
This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

825 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