SteveL13
asked on
DSum not working correctly
I am using DSum as a default value on a form but am not getting the correct result. Probably because I have " and ' marks wrong. Can someone help? Here my code:
=DSum("Qty","tblProdInvent ory","'Sty le = #10 Product' & 'CompanyName = frmProjectDetail!txtCompan y'")
--Steve
=DSum("Qty","tblProdInvent
--Steve
=DSum("Qty","tblProdInvent ory","Styl e = '#10 Product' AND CompanyName ='" & frmProjectDetail!txtCompan y & "'")
Sorry, posted too quickly:
Also, understand that a Default value ONLY impacts New records. It will have absolutely no impact on Existing records.
And, in your case, if there is no value in txtCompany, or if txtCompany is on the same Form where you're running this, then you will almost certainly run into issues with it.
Also, understand that a Default value ONLY impacts New records. It will have absolutely no impact on Existing records.
And, in your case, if there is no value in txtCompany, or if txtCompany is on the same Form where you're running this, then you will almost certainly run into issues with it.
ASKER
I pasted this in the default value and am getting a #Name? result. ??
Try this one
=DSum("[Qty]","tblProdInve ntory","[S tyle] = '#10 Product' And [CompanyName] =' " & Forms!frmProjectDetail!txt Company & "'")
Sincerely,
Ed
=DSum("[Qty]","tblProdInve
Sincerely,
Ed
ASKER
Tried that one and now I get no result in the field.
No leading space:
=DSum("Qty","tblProdInvent ory","Styl e = '#10 Product' And CompanyName = '" & frmProjectDetail!txtCompan y & "'")
/gustav
=DSum("Qty","tblProdInvent
/gustav
i = DSum("Qty", "tblProdInventory", "Style = '#10 Product' And CompanyName = 'frmProjectDetail!txtCompa ny'")
cactus_data:
my bad. i didnt refresh before i saw your comment
my bad. i didnt refresh before i saw your comment
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.