Avatar of pdvsa
pdvsaFlag for United States of America

asked on 

Dsum - add criteria for [PaymentDate]

Experts, how can I modify the below False part (the Dsum) to only sum if tblPayments.[PaymentDate] is not null (meaning the field has a date in it).  The below is in the query design window.  II am not sure if it matters but tblPayments is not a table in the query.  

thank you


SumPayments: IIf([PaidInFullYN]=True,"Paid In Full",DSum("Amount","tblPayments","[LCID] = " & [LetterOfCreditID]))
Microsoft Access

Avatar of undefined
Last Comment
John Tsioumpris
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

SumPayments: IIf([PaidInFullYN]=True,"Paid In Full",NZ(DSum("Amount","tblPayments","[LCID] = " & [LetterOfCreditID]),0))

Jim.

ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of pdvsa
pdvsa
Flag of United States of America image

ASKER

Hi guys, thanks for the responses.  

do you know  why it works in the query design window but when I drag the field onto the report it gives me an error after running rpt of  the User generated imagefollowing.  tblPayments is not in the record source if that matters.  I do not get the error if I remove the:  And [PaymentDate] Is Not Null"

Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

But why not leave it in the query? In most case the query is better to do the hard work than the report.
Also, remove any sorting in the source query if present. Move that to the report.
SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo