Results 1 to 7 of 7
  1. #1
    fishhead is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    167

    filter sort

    I have a form based on a union query that has the following fields

    [inv $]
    [curr]
    [quote type]

    the [curr] field has either CDN or USD results and i can SUM this field with the following expressions :


    =Sum(-[inv $]*([curr]="CDN"))
    =Sum(-[inv $]*([curr]="USD"))

    the [quote type] field has many result groups but can be separated by :
    =truck*
    <>truck*

    Is there a way i can add to my SUM expressions to show the CDN results for =TRUCK* and <> TRUCK* and the USD results for =TRUCK* and <>TRUCK*?

    thanks in advance.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Value has or doesn't have "truck" prefix?

    So now you want 4 calculations?

    =Sum(IIf([curr]="CDN" AND [quote type] LIKE "truck*", -[inv $]*[curr], Null))

    =Sum(IIf([curr]="CDN" AND [quote type] NOT LIKE "truck*", -[inv $]*[curr], Null))

    =Sum(IIf([curr]="USD" AND [quote type] LIKE "truck*", -[inv $]*[curr], Null))

    =Sum(IIf([curr]="USD" AND [quote type] NOT LIKE "truck*", -[inv $]*[curr], Null))
    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
    fishhead is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    167
    I get an #Error message with any of the above.
    is there something i'm missing?

    thanks,
    Steve

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Ooops, typo. Remove ( after *. Edited previous post.
    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
    fishhead is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    167
    hummm. i'm still getting the same error

    =Sum(IIf([curr]="CDN" And [quote type] Like "truck*",-[inv $]*[curr],Null))

    any other suggestions?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Sorry, I should really read what I am copy/pasting.

    =Sum(IIf([curr]="CDN" AND [quote type] LIKE "truck*", [inv $], Null))

    =Sum(IIf([curr]="CDN" AND [quote type] NOT LIKE "truck*", [inv $], Null))

    =Sum(IIf([curr]="USD" AND [quote type] LIKE "truck*", [inv $], Null))

    =Sum(IIf([curr]="USD" AND [quote type] NOT LIKE "truck*", [inv $], Null))

    or going with the original concept

    =Sum(-[inv $] * ([curr] = "CDN" AND [quote type] LIKE "truck*"))

    =Sum(-[inv $] * ([curr] = "CDN" AND [quote type] NOT LIKE "truck*"))

    =Sum(-[inv $] * ([curr] = "USD" AND [quote type] LIKE "truck*"))

    =Sum(-[inv $] * ([curr] = "USD" AND [quote type] NOT LIKE "truck*"))
    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.

  7. #7
    fishhead is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    167
    WORKS perfectly!
    thanks,June7

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

Similar Threads

  1. Mainform filter disrupts subform sort
    By PDilly in forum Forms
    Replies: 2
    Last Post: 07-28-2019, 03:15 PM
  2. Cant filter or sort columns in a form
    By whilburn in forum Forms
    Replies: 7
    Last Post: 03-08-2019, 04:44 AM
  3. Filter Query to Sort Records on Form
    By accessuser10 in forum Forms
    Replies: 2
    Last Post: 03-18-2014, 03:50 PM
  4. Sort Order In Query Dies On Filter
    By VariableZ in forum Queries
    Replies: 12
    Last Post: 07-09-2013, 08:19 PM
  5. sort filter, doesn't sort everything
    By deso in forum Queries
    Replies: 4
    Last Post: 01-25-2013, 05:27 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