Solved

DSum Help

Posted on 2006-06-29
9
471 Views
Last Modified: 2008-03-10
I have a control source on an unbound text box in a form as follow:

=Nz(DSum("[Qty]","tblCutSourceInvtySM","[ItemNo]=" & [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
0
Comment
Question by:perennial
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 26

Accepted Solution

by:
dannywareham earned 500 total points
ID: 17012394
The error  #name?  means that it doesn't recognise the function parts.
Either wrong arguements, or wrong names.

Try:

=NZ(DSum("Qty", "tblCutSourceInvtySM", "ItemNo =" & [ItemNo] & " AND DatRevd >=#" & Date()-7 & "#"),0)


0
 
LVL 26

Expert Comment

by:dannywareham
ID: 17012404
Your table names/fields don't need to be in square brackets.
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)
0
 
LVL 44

Expert Comment

by:GRayL
ID: 17012411
Try this, assumig ItemNo is a number, not text:

=Nz(DSum("[Qty]","tblCutSourceInvtySM","[ItemNo]=" & [Me].[ItemNo] & " AND [DatRevd] >= #" & (Date())-7 & "#"),0)

0
 
LVL 1

Author Comment

by:perennial
ID: 17012428
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
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 26

Expert Comment

by:dannywareham
ID: 17012457
This is ON a form, rather than in code?
0
 
LVL 44

Expert Comment

by:GRayL
ID: 17012526
Are you sure of table and field spelling?
0
 
LVL 1

Author Comment

by:perennial
ID: 17012855
Got it.  Let me test it out and I will let you know.

perennial
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17013108
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)

0
 
LVL 1

Author Comment

by:perennial
ID: 17013151
ItemNo is a numeric field...however I believe dannywareham got.

Thanks for the suggestion.

perennial
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now