Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dsum help

Posted on 2016-08-16
6
Medium Priority
?
66 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
[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
  • 3
  • 3
6 Comments
 
LVL 39

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 39

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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 39

Accepted Solution

by:
PatHartman earned 2000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
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 …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

721 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