perennial
asked on
DSum Help
I have a control source on an unbound text box in a form as follow:
=Nz(DSum("[Qty]","tblCutSo urceInvtyS M","[ItemN o]=" & [Me].[ItemNo] & " AND “[DatRevd] >= “ & #" & (Date())-7 & "#"),0)
When I try to run the form, in the text unbound text box it display this message: #Name?
What did I forget to put in?
perennial
=Nz(DSum("[Qty]","tblCutSo
When I try to run the form, in the text unbound text box it display this message: #Name?
What did I forget to put in?
perennial
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try this, assumig ItemNo is a number, not text:
=Nz(DSum("[Qty]","tblCutSo urceInvtyS M","[ItemN o]=" & [Me].[ItemNo] & " AND [DatRevd] >= #" & (Date())-7 & "#"),0)
=Nz(DSum("[Qty]","tblCutSo
ASKER
Here is a message:
The object doesn't contain the Automation object 'DatRevd.'
You tried to run a Visual Basic procedure toset a property or method for an object. However, the component does't make the property or method available for automation operations.
Check the conponent's documentation for information on the properities and mothods it maks available for automation operations.
I am not sure what it mean....did I not allow or check something?
perennial
The object doesn't contain the Automation object 'DatRevd.'
You tried to run a Visual Basic procedure toset a property or method for an object. However, the component does't make the property or method available for automation operations.
Check the conponent's documentation for information on the properities and mothods it maks available for automation operations.
I am not sure what it mean....did I not allow or check something?
perennial
This is ON a form, rather than in code?
Are you sure of table and field spelling?
ASKER
Got it. Let me test it out and I will let you know.
perennial
perennial
Hey prennial, is ItemNo definitely a numeric field and not a string
mind u, you probably get a different error message anyway
But if it is a string, u need to use single quotes
After trying the suggestions from the other experts
try this
select qty, itemno, daterevd from tblCutSourceInvtySM
does this query work?
if so, An alternative is to use DateDiff
Nz(DSum("Qty", "tblCutSourceInvtySM", "ItemNo = " & ItemNo.Value & " AND DateDiff('d',DatRevd,Now() )>=7)"), 0)
mind u, you probably get a different error message anyway
But if it is a string, u need to use single quotes
After trying the suggestions from the other experts
try this
select qty, itemno, daterevd from tblCutSourceInvtySM
does this query work?
if so, An alternative is to use DateDiff
Nz(DSum("Qty", "tblCutSourceInvtySM", "ItemNo = " & ItemNo.Value & " AND DateDiff('d',DatRevd,Now()
ASKER
ItemNo is a numeric field...however I believe dannywareham got.
Thanks for the suggestion.
perennial
Thanks for the suggestion.
perennial
Also, form controls are only refered to as ME in code - not calculated controls.
What you have is half written as code and half written as calculated field (like a query)