Report Textbox Expression error

Robert Schumann
Robert Schumann used Ask the Experts™
on
HI

Where am I going wrong with this expression.  It's returning all Invoice values.  If I drop the last part  And "[id]=19 it returns the correct value.

=Nz(DSum("Invoice","PurchaseOrders","[ordertype]='opex'" And "[id]=19"),0)

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Try with:

=Nz(DSum("Invoice","PurchaseOrders","[ordertype]='opex' And [id]=19"),0)

Open in new window

Robert SchumannFacilities Planner

Author

Commented:
Great, it's working.  Thanks

Now, I need to add another criteria.  Tried this, but it returns "$0.00"  Thought I could just add an addition "AND".

=Nz(DSum("Invoice","PurchaseOrders","[ordertype]='opex' And [id]=19 And [id]=17"),0)
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Id cannot be both 17 and 19.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Software & Systems Engineer
Commented:
ANd ID IN (17,19)
Robert SchumannFacilities Planner

Author

Commented:
Thank you all.  Great help!!
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
It was a pleasure to supply the answer to your initial question.

I'm sorry I didn't guess, that what you next meant was:

=Nz(DSum("Invoice","PurchaseOrders","[ordertype]='opex' And ([id]=19 Or [id]=17)"),0) 

Open in new window

Robert SchumannFacilities Planner

Author

Commented:
Thank you both.  They were both great answers!!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial