Results 1 to 4 of 4
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    DSUM Where Expression not working

    I have a text box whose control source is =fnIncome(). Under certain conditions, the DSUM function used in the fnIncome function is to be limited to entries for the previous year only. Here is a screen-shot of what I'm seeing in Debug: (PrevYrInc is True)



    Click image for larger version. 

Name:	AlwaysNull.jpg 
Views:	15 
Size:	183.2 KB 
ID:	19815

    Now, notice the Income values in the Ledger table for the 1st DSUM executed that returned NULL but should have returned the sum for 2014.

    Click image for larger version. 

Name:	Ledger.jpg 
Views:	15 
Size:	143.3 KB 
ID:	19816

    What am I missing?

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You might try adding the date delimiters (#).

    Code:
    WhereExp = WhereExp & " [DOE] >=#" & LastJan1 & "# AND [DOE] <= #" & LastDec31 & "#"

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Or:

    " [DOE] BETWEEN #" & LastJan1 & "# AND #" & LastDec31 & "#"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    The "#" delimiter was all that was needed. (I liked June's reply as well, but didn't see it until later.)

    Click image for larger version. 

Name:	Inc.jpg 
Views:	13 
Size:	52.3 KB 
ID:	19818

    Click on the heading and Viola

    Click image for larger version. 

Name:	Inc2014.jpg 
Views:	13 
Size:	55.2 KB 
ID:	19819

    Thanks,
    Bill

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

Similar Threads

  1. Dsum was working now it is not working
    By ssalem in forum Reports
    Replies: 7
    Last Post: 04-18-2013, 02:57 PM
  2. Replies: 6
    Last Post: 02-28-2013, 05:38 PM
  3. Expression not working in query
    By Bob Blooms in forum Access
    Replies: 4
    Last Post: 08-25-2012, 08:42 AM
  4. Dsum expression help please
    By manos39 in forum Forms
    Replies: 1
    Last Post: 12-12-2011, 05:50 PM
  5. Replies: 13
    Last Post: 12-05-2011, 05:10 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