Solved

Dsum help

Posted on 2016-08-16
6
50 Views
Last Modified: 2016-08-16
Experts,
 
Im tring to sum the amount in the form in the attached db.  I am way off and have spent too much time trying to see where I am wrong so I am turning it over to the experts.   I have pared down the db to only what is needed and the form appears auto.   Please double click the amount in the form that appears on auto and then another form appears that shows the amount calculated with the formula below.  I am just trying to sum these amounts.  I imagine an expert has a different way of doing this.  I am not sure if dsum is the correct method.  

=Sum(Format(Nz(DSum("[Amount]","tblDraws_Details1","[ID] = " & [tblRepayment].[DrawIDrpmt]),0),"Standard"))+
+Sum((Format(Nz(DSum("[Amount]","tblRepayment","[DrawIDrpmt] = " & [tblRepayment].[DrawIDrpmt]),0),"Standard")))

the answer should be
-6,796,284.00 (282,000,000.00-282,000,000.00-6,010,597.00-785,687.25)
but I am getting:
-20,388,852.75

I am greatful for your kindness and time.
thank you.  please see attached.
EE.accdb
0
Comment
Question by:pdvsa
  • 3
  • 3
6 Comments
 
LVL 36

Expert Comment

by:PatHartman
ID: 41758285
Your syntax is not correct and why are you formatting inside the expression?  Format() returns a string.  You also don't need NZ() when using DSum()

=Sum(DSum("[Amount]","tblDraws_Details1","[ID] = " & [DrawIDrpmt] )
+Sum(DSum("[Amount]","tblRepayment","[DrawIDrpmt] = " & [DrawIDrpmt] )

I don't know where you want this on the form so I didn't try it.

You can set the format of the control to standard rather than embedding the Format() function in the expression.
0
 

Author Comment

by:pdvsa
ID: 41758372
Hi Pat,

thanks for the response.  

Would you happen to know why I get a #error?
0
 
LVL 36

Expert Comment

by:PatHartman
ID: 41758404
There is something wrong with the expression.

Where in the app is the expression you posted?  If I get a minute, I'll try to fix it.
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 36

Accepted Solution

by:
PatHartman earned 500 total points
ID: 41758466
I added a second field so you could see the two expressions.
EE.accdb
0
 

Author Comment

by:pdvsa
ID: 41758779
Nice!
that works.  I will need to ask a follow up because I need another condition of tblRepayment.PaymentMadeYN="Yes".  I am fiddling with it and cant figure it out.   thank you for your expert assistance and the tips about dsum and nz.  I am not a coder as you probably figured out.
0
 

Author Closing Comment

by:pdvsa
ID: 41758841
Pat, will post another question.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

830 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