Results 1 to 2 of 2
  1. #1
    Petrosdidymos is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    1

    Problem using < in the DSum and DCount functions on a report

    I have a report that I use and one of the cells is using this string to return a percentage:



    =(DCount("[Actual Response Time]","Service Calls Last Week Response Time Measured","[Actual Response Time]<120")/DCount("[Actual Response Time]","Service Calls Last Week Response Time Measured","[Actual Response Time]>0"))

    The report stop working and started returning "Error#" in all of the cells with similar formulas in it.

    I played around with it yesterday and it appears that the < and > functions are no longer working as a criteria.

    Does anyone have any experience with this or suggestions on how to make this work?

    Thanks.

  2. #2
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    First, put braces around [Service Calls Last Week Response Time Measured] everywhere it occurs. Then see what happens.

    Second, you might consider ensuring that the denominator is always greater than zero. It's uglier than your curent code, but it's something like this -
    Code:
    =((DCount("[Actual Response Time]","[Service Calls Last Week Response Time Measured]","[Actual Response Time]<120"))/(IIF(DCount("[Actual Response Time]","[Service Calls Last Week Response Time Measured]","[Actual Response Time]>0")>0,DCount("[Actual Response Time]","[Service Calls Last Week Response Time Measured]","[Actual Response Time]>0"),1))
    or you could implement and use a public function to pick the greater of two integers:
    Code:
    Public Function GreaterInt(Int1 As Integer, Int2 As Integer) AS Integer
      If int1 > int2 Then 
         GreaterInt = Int1
      Else
         GreaterInt = Int2
      End if
    End Function  
    =((DCount("[Actual Response Time]","[Service Calls Last Week Response Time Measured]","[Actual Response Time]<120"))/GreaterInt(DCount("[Actual Response Time]","[Service Calls Last Week Response Time Measured]","[Actual Response Time]>0"),1)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. DSum problem.
    By kowalski in forum Access
    Replies: 1
    Last Post: 10-26-2012, 05:24 PM
  2. Dsum problem help?
    By manos39 in forum Forms
    Replies: 0
    Last Post: 01-12-2012, 05:53 AM
  3. Replies: 5
    Last Post: 12-15-2011, 11:16 AM
  4. DSum problem, please help!!
    By Chissy in forum Queries
    Replies: 3
    Last Post: 08-10-2011, 07:39 AM
  5. DSum or DCount
    By vdanelia in forum Forms
    Replies: 1
    Last Post: 03-01-2011, 03:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums