Results 1 to 5 of 5
  1. #1
    samthomasny is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2011
    Posts
    7

    Conditional Sum Function

    Can anyone tell me what is wrong with this formula below?



    Usage: IIf(([GTORSH]![PITEM]=[tbl_Inventory]![Item#]) And ([GTORSH]![PSHPDT]>=[BeginDate]) And ([GTORSH]![PSHPDT]<=[EndDate]),Sum([GTORSH]![PSHQTY]),0)

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Usage: Sum(IIf([GTORSH]![PITEM]=[tbl_Inventory]![Item#] And ([GTORSH]![PSHPDT] Between [BeginDate] And [EndDate],[GTORSH]![PSHQTY],0))

    How are BeginDate and EndDate values captured?
    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.

  3. #3
    samthomasny is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2011
    Posts
    7
    [BeginDate] And [EndDate] will be entered as parameter values when the query runs.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Okay, is my suggestion working?

    I don't use input parameter prompts, can't validate. I have users enter values on form and refer to the controls on form for input parameters.
    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.

  5. #5
    samthomasny is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2011
    Posts
    7
    Thx a million June7.
    I had to modify your suggestion only a little bit: Usage: Sum(IIf([GTORSH]![PITEM]=[tbl_Inventory]![Item#] And ([GTORSH]![PSHPDT]>=[BeginDate]) And ([GTORSH]![PSHPDT]<=[EndDate]),[GTORSH]![PSHQTY],0))

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

Similar Threads

  1. Using conditional COUNT function
    By Laura WW in forum Reports
    Replies: 3
    Last Post: 11-08-2011, 11:59 PM
  2. Conditional Printing
    By anoob in forum Forms
    Replies: 28
    Last Post: 03-18-2011, 01:51 PM
  3. Conditional Query
    By thegladiator in forum Queries
    Replies: 1
    Last Post: 01-14-2011, 11:44 AM
  4. Conditional Formatting
    By DanOzDirect in forum Reports
    Replies: 3
    Last Post: 07-21-2010, 08:49 PM
  5. Want function to get current function name
    By Davis DeBard in forum Programming
    Replies: 2
    Last Post: 08-13-2009, 05:02 AM

Tags for this Thread

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