SteveL13
asked on
Another syntax issue
What is wrong with:
(DSum("[QTY_ORDERED]","tbl Inventory" ,"[PART_NO ] = '" & [Forms]![frmParts]![txtPAR T_NO] & "' AND [TRNX_TYPE] ="ORD"")
(DSum("[QTY_ORDERED]","tbl
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That one worked. Thank you!
You're welcome. I remember struggling when I first built these domain aggregate functions, especially when inserting control values like [Forms]![frmParts]![txtPAR T_NO] into the formula. I find it helps to temporarily replace them with a hard-coded value because it simplifies the testing and makes the formula easier to examine for balance (open/close brackets, paired single & double quotes).
Also worth spacing out the single and double quotes where possible to improve readability.
=DSum("[QTY_ORDERED]","tblInventory","[PART_NO] = '" & [Forms]![frmParts]![txtPART_NO] & "' AND [TRNX_TYPE] ="ORD"")
v
=DSum("[QTY_ORDERED]","tblInventory","[PART_NO] = '55' AND [TRNX_TYPE] ='ORD' ")
Notice that when you take the reference to the control out you can also take out the surrounding & and " from either side, so it makes quite a difference to the length of the formula. Also worth spacing out the single and double quotes where possible to improve readability.
ASKER
Simon,
Yes, the single and double quotes really confuse me.
--Steve
Yes, the single and double quotes really confuse me.
--Steve
(DSum("[QTY_ORDERED]","tbl
Flyster