Solved

Dsum help

Posted on 2016-08-16
6
27 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 34

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 34

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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 34

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

758 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now