Results 1 to 9 of 9
  1. #1
    JeanZander is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2012
    Posts
    12

    Cool Date Filtering within a Formula

    I am new to this forum, so I apologize in advance for not searching for the answer to my question first. I have a formula that works, but does not complete the desired result. It is adding the total of monies recouped from selling surplus properties. The problem is I need to know the total dollars recouped during a certain period 7/1/12 thru 6/30/13. The field needed to access this information is called [Disp Date]. Any takers?!



    =DSum("[$$ Disposition Proceeds]","[UTA Property Database]")

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    First recommendation -- DO NOT use embedded spaces or special characters in Access field or object names.
    second recommendation -- review the examples here
    http://www.techonthenet.com/access/f...omain/dsum.php

  3. #3
    JeanZander is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2012
    Posts
    12
    Thanks, but my expressions seem to work fine with the embedded spaces and special characters; unfortunately, the examples you suggested don't seem to include expressions filtering dates. I guess I can filter the dates manually from my form. I just thought someone might know the syntax to filter a date range within an expression. Thanks anyway.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    =DSum("[$$ Disposition Proceeds]","[UTA Property Database]","[FIELDNAME] = 'VALUE'")

    for a text field

    =DSum("[$$ Disposition Proceeds]","[UTA Property Database]", "[FIELDNAME] = VALUE")

    for a number field

    =DSum("[$$ Disposition Proceeds]","[UTA Property Database]", "[FIELDNAME] = #VALUE#")

    for a date field

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Try this

    Code:
    =DSum("[$$ Disposition Proceeds]","[UTA Property Database]","[Disp Date] between #7/1/12# AND #6/30/13#")

  6. #6
    JeanZander is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2012
    Posts
    12
    Thanks Orange!!! You're a genius...to me! That worked perfectly. Just one question, can I add: , "0" before the last quote or something so if the answer is zero it puts in a zero rather than a blank box?

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    You can try this, but I haven't tested it


    =IIF(DSum("[$$ Disposition Proceeds]","[UTA Property Database]","[Disp Date] between #7/1/12# AND #6/30/13#")>0,DSum("[$$ Disposition Proceeds]","[UTA Property Database]","[Disp Date] between #7/1/12# AND #6/30/13#"),0)

    This is an immediate IF (IIF) -below is the syntax.
    IIf (condition, truepart, falsepart)

  8. #8
    JeanZander is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2012
    Posts
    12
    BRAVO!! It was brilliant. Worked perfectly

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

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

Similar Threads

  1. Syntax of a Formula using Date Part
    By Huddle in forum Reports
    Replies: 14
    Last Post: 09-25-2012, 12:49 PM
  2. IIF formula in an unbound text box using date()
    By probablyjoel in forum Forms
    Replies: 3
    Last Post: 04-20-2012, 12:03 PM
  3. Filtering forms by date
    By rwest in forum Forms
    Replies: 1
    Last Post: 01-03-2012, 11:23 AM
  4. Date Filtering problem
    By TubbyGrey in forum Access
    Replies: 6
    Last Post: 10-22-2010, 10:46 PM
  5. Complex Date Comm/Amt Formula
    By JLongo in forum Programming
    Replies: 0
    Last Post: 11-21-2008, 10:24 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