Solved

Dsum help

Posted on 2016-08-16
6
59 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 38

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 38

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
Technology Partners: 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 38

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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

628 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