By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,453 Members | 3,225 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,453 IT Pros & Developers. It's quick & easy.

Multiple Criteria Search.....Proper Syntax

P: 74
Please help. I know the sysntax is wrong. Here are some details. I am looking for the sum of past shipped items. I originally wrote this Dsum with only one criteria, but because of multiple lineitems with the same [workorder] number it was adding all of the items with the same [workorder]....obviously. So i tried to just find records with multiple criteria..... part number [pn] (formatted as text) and the [workorder] (formatted as number).

Expand|Select|Wrap|Line Numbers
  1. Nz(DSum("shipqty", "tblshippingdetails", "[pn] =" & """ & Forms!frmsodetailssearch.pn & """ & " And [WorkOrder] =" & Me![SalesOrderNumber]), 0)
I really strugle when it comes to multiple criteria in filters and counts. I am trying to get better. By the way..... this code does not give an error, but it is not giving the correct result. originally i tried

Expand|Select|Wrap|Line Numbers
  1. Nz(DSum("shipqty", "tblshippingdetails", "[WorkOrder] =" & Me![SalesOrderNumber] and "[pn] =" Forms!frmsodetailssearch.pn), 0)
But i got syntax error during compile. I figured when i didnt get the error (top line of code) that i had succeeded......but nope...no success.
Mar 5 '09 #1
Share this Question
Share on Google+
3 Replies


FishVal
Expert 2.5K+
P: 2,653
Hello.

You could find an answer in Quotes (') and Double-Quotes (") - Where and When to use them article.

Regards,
Fish.

P.S. If you want to include double-quote in string constant you should type it twice to let Access distinguish it from string end.
Mar 5 '09 #2

P: 74
Oops, ok so 4 " instead of 3 " worked great. Thanks.
Mar 5 '09 #3

FishVal
Expert 2.5K+
P: 2,653
You are welcome.

Best regards,
Fish.
Mar 5 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.