Solved

DSum Help

Posted on 2006-06-29
9
490 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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
 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

776 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