Solved

DSUM Lookup on Table - with Filter

Posted on 2013-01-16
10
406 Views
Last Modified: 2013-01-16
I have a form into which I'm using an "On Open" event.  If the total for [In] table of the [Amt] field = 0, where grouped [Srce_Type] = "Lockbox", then perform an operation.

I know I could write a GROUP BY query to return the desired output but was hoping to filter and sum total in a simpler way.  
Example:     If DSum("[Amt]", "[In]", [Srce_Type] = "Lockbox") = "0" Then

Is there a simple VBA line which would perform this operation?
0
Comment
Question by:CFMI
[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
  • 5
  • 4
10 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 375 total points
ID: 38783384
syntax is

If DSum("[Amt]", "[In]", "[Srce_Type] = 'Lockbox'") = 0  Then
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 125 total points
ID: 38783391
this should do:


If DSum("[Amt]", "[In]", "[Srce_Type] = 'Lockbox'") = 0 Then
0
 
LVL 1

Author Comment

by:CFMI
ID: 38783445
Okay now let's build on that.  Two scenarios:
1) If there are two possible filters - either Lockbox / or Cashbox, do I enter

If DSum("[Amt]", "[In]", "[Srce_Type] = 'Lockbox'") = 0 or If DSum("[Amt]", "[In]", "[Srce_Type] = 'Cashbox'") = 0 Then

2) If IsNull [Srce_Type], do I enter

If DSum("[Amt]", "[In]", "IsNull([Srce_Type])") = 0 Then
0
Industry Leaders: 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!

 
LVL 1

Author Comment

by:CFMI
ID: 38783457
Or how about if  "Is NOT Null([Srce_Type] ??"  . . I know that's a third scenario but thanks.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38783484
so what is now the question here?
0
 
LVL 1

Author Comment

by:CFMI
ID: 38783506
3) if the event should occur where [Srce_Type] is NOT null, then what is syntax?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38783540
<if the event should occur where [Srce_Type] is NOT null, then what is syntax? >

i don't understand, what you are trying to do, first you want to get the sum, using

If DSum("[Amt]", "[In]", "[Srce_Type] = 'Lockbox'") = 0 then

if   [Srce_Type] is null or emplty or blank, then it will not be included in the SUM of the AMT
0
 
LVL 1

Author Comment

by:CFMI
ID: 38783579
"if [Srce_Type] is null or empty or blank, then it will not be included in the SUM of the AMT"

That is correct but in the prior statements I was looking for totals for only certain records.  In this case, I'm looking for totals of ALL records where [Srce_Type] is null or empty or blank.
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 375 total points
ID: 38783585
<I'm looking for totals of ALL records where [Srce_Type] is null or empty or blank. >

then use this

If DSum("[Amt]", "[In]", "[Srce_Type] is Null") = 0 then

or


If DSum("[Amt]", "[In]", "IsNull([Srce_Type])") = 0 then
0
 
LVL 1

Author Closing Comment

by:CFMI
ID: 38783612
Thanks so much for your patience.
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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Familiarize people with the process of utilizing SQL Server functions 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 Ac…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 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