Hi,
I have the following formula on a report:
=DCount(“*”,”tblValuations”,”[tblValuations]![CreateValuation]>=[reportdate] and =[reportdate] and <=[reportdate2]"[/B] section?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Help with formula
Hi,
I have the following formula on a report:
=DCount(“*”,”tblValuations”,”[tblValuations]![CreateValuation]>=[reportdate] and =[reportdate] and <=[reportdate2]"[/B] section?
Here is a clean solution for your DCount:
=DCount("*","tblValuations","([CreateValuation] Between [reportdate] and [reportdate2]) AND [SalesID] = " & [Reports]![tblSalesman2]![SalesID].Value)
I enclose the date part of the criteria within parenthesis more for clarity than anything else; it's a habit. Be sure that your [CreateValuation] and both reportdates are all just date values with no time portion attached, or you might not get exactly the count you expect. You can assure that with the DateValue() function:
=DCount("*","tblValuations","(DateValue([CreateValuation]) Between DateValue([reportdate]) and DateValue([reportdate2])) AND [SalesID] = " & [Reports]![tblSalesman2]![SalesID].Value)
Of course, this level of precision is not necessary if you know for certain that you never have time-of-day in your dates.
Cheers!
Thanks.
I have a similar problem now with the following:
=DCount(“[IncomingCalls]”,”tblCallHistory”,”([tblCallHistory]![CallDate] Between [dates1] and [dates2]) AND [SalesID] = ” & [Reports]![rptWeeklyActivityReport]![SalesID].[Value])
I basically want it to add the value of all reords in the field IncomingCalls between the two dates specified and for that particular person based upon their salesid. However it is not giving me the information back I expect, it is only counting the number of records.
Thanks. I have a similar problem now with the following:
=DCount(“[IncomingCalls]”,”tblCallHistory”,”([tblCallHistory]![CallDate] Between [dates1] and [dates2]) AND [SalesID] = ” & [Reports]![rptWeeklyActivityReport]![SalesID].[Value])
I basically want it to add the value of all reords in the field IncomingCalls between the two dates specified and for that particular person based upon their salesid. However it is not giving me the information back I expect, it is only counting the number of records.
Forgive me for pointing it out, but in your example you have asked it to Count, not Add. Use DSum(). I hope this solves your problem.
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications