Jim-
DSum will return Null if there are no records. Maybe you want:
=NZ(DSum("[TimeSpent]","tblTaskDetails","[TaskUpdateDate] =#" & Date() &
"#"))+Nz([Text117],0)
John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Jim Wagner
Sent: Saturday, July 30, 2011 1:44 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] DSum question
Duane,
As soon as I put a dummy record in the subform the field is populated with a
value on the main form.
Jim Wagner
________________________________
________________________________
From: Duane Hookom <duanehookom@hotmail.com>
To: Access Professionals Yahoo Group <ms_access_professionals@yahoogroups.com>
Sent: Friday, July 29, 2011 4:30 PM
Subject: RE: [MS_AccessPros] DSum question
Jim,
It really doens't matter which "form" the data is displayed. This expression is
all about the tables and fields. The only requirement is that Text117 is on the
same form as the text box.
Today's date is Date()
=DSum("[TimeSpent]","tblTaskDetails","[TaskUpdateDate] =#" & Date() &
"#")+Nz([Text117],0)
BTW: "Text117"? Kick it up a notch. Every significant control deserves a decent
name ;-)
Duane Hookom
MS Access MVP
To: MS_Access_Professionals@yahoogroups.com
From: luvmymelody@yahoo.com
Date: Fri, 29 Jul 2011 22:52:11 +0000
Subject: [MS_AccessPros] DSum question
Hello,
I have a form with a text box with the below expression. This expression used to
work, but it seems that something has changed on it.
I am trying to get the totals of today's task hours from the main form and the
subform. For some reason I can only see totals for dates that do not happen on
today. So the expression works but not for today's date.
TimeSpent is on the main form
TaskUpdateDate is on the subform from the table tblTaskDetails.
Text117 is on the main form
I started with this expression but realized if there is a null there would be 0.
So I tweaked the expression to the one below.
=nz(DSum("[TimeSpent]","tblTaskDetails","[TaskUpdateDate] =
[Date]")+[Text117],0)
If anyone sees the problem I would appreciate the help
Thank you
Jim Wagner
[Non-text portions of this message have been removed]
------------------------------------
Yahoo! Groups Links
[Non-text portions of this message have been removed]
------------------------------------
Yahoo! Groups Links
Jumat, 29 Juli 2011
RE: [MS_AccessPros] DSum question
__._,_.___
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar