Results 1 to 9 of 9
  1. #1
    kbassnac is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2011
    Posts
    5

    Calculated field with NOT Equal issue

    I'm working on a calculated field that should sum do the following:
    CYPending=Sum of all [Requests].[Request] by [Requests].[Program] and [Requests].[FiscalYear] where [Requests].[OrigGrant] is null and [Requests].[DGR] is null AND [Requests].[Status] does not equal “W”

    This is what I have so far CYPending: CCur(Nz(DSum("Nz([Request])","REQUESTS","FiscalYear='" & [FiscalYear] & "' and Program=""" & [REQUESTS].[Program] & """ and [REQUESTS].[OrigGrant] IS NULL and [REQUESTS].[DGR] IS NULL and [REQUESTS].[Status] <> ('""W""')")))

    However, the value that is returned is not correct. If I remove Status from the calculation it works fine.




    Any help would be appreciated,
    Kathy in NE

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    why triple quotes around it? it isn't a form control call...

    just a quick off the cuff thought.

  3. #3
    kbassnac is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2011
    Posts
    5
    Thanks for the response.
    I was told to use the mutliple quotes since the Status field was a drop down text field. I did try it with just "W" and I received the same incorrect value.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Does this work?

    and [REQUESTS].[Status] <> 'W'
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    kbassnac is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2011
    Posts
    5
    Thanks, but that didn't work either.
    The returned value is the calculation the total of [Requests].[Request] by [Requests].[Program] and [Requests].[FiscalYear] where [Requests].[Status] equals “W” and [Requests].[OrigGrant] is null and [Requests].[DGR] is null

  6. #6
    kennejd is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    188
    Try this:
    dsum("[Request]","Requests","FiscalYear='" & [FiscalYear] & "' AND [Program]='" & [Program] & "' AND isnull([OrigGrant]) = true AND isnull([DGR]) = true and [Status] <> 'w'")

  7. #7
    kbassnac is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2011
    Posts
    5
    Thank you, but dsum("[Request]","Requests","FiscalYear='" & [FiscalYear] & "' AND [Program]='" & [Program] & "' AND isnull([OrigGrant]) = true AND isnull([DGR]) = true and [Status] <> 'w'") did not work, either. It returned a zero value in the field.

    I'm open to more suggestions, please.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Can you post a sample db along with the expected result?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    kbassnac is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2011
    Posts
    5
    Thanks for the help. I did get a resolution for this question and thought I would post it. Not sure how to mark this one as Solved.

    CYPending: CCur(Nz(DSum("Nz([Request])","REQUESTS","FiscalYear='" & [FiscalYear] & "' and Program=""" & [REQUESTS].[Program] & """ and [REQUESTS].[OrigGrant] IS NULL and [REQUESTS].[DGR] IS NULL and (Not ([REQUESTS].[Status] = 'W') Or REQUESTS.Status is Null)")))

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

Similar Threads

  1. Calculated Field (if/then) Help
    By agent- in forum Programming
    Replies: 10
    Last Post: 03-30-2011, 05:43 PM
  2. calculated field
    By nashr1928 in forum Forms
    Replies: 2
    Last Post: 03-30-2011, 04:29 PM
  3. calculated field from calculated field?
    By RedGoneWILD in forum Reports
    Replies: 5
    Last Post: 08-03-2010, 02:32 PM
  4. Calculated field
    By nashr1928 in forum Forms
    Replies: 9
    Last Post: 08-01-2010, 01:59 PM
  5. Calculated field
    By nashr1928 in forum Forms
    Replies: 3
    Last Post: 07-22-2010, 05:10 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