Results 1 to 4 of 4
  1. #1
    suverman is offline Novice
    Windows XP Access 2003
    Join Date
    May 2011
    Posts
    15

    IIF Problems

    SELECT L4, L3, L5, IIf([sum(DR)]>[sum(CR)],[sum(DR)]-[sum(CR)],0), IIf([sum(CR)]>[sum(DR)],[sum(CR)]-[sum(DR)],0)


    FROM GL
    WHERE L4 not in (0)
    GROUP BY L4, L3, L5;

    This is the code that isnt working, asking for parameters of "sum(dr)".


    What i basically want is, to net the fields DR and CR first and then summation it according to codes. Thank you.

  2. #2
    suverman is offline Novice
    Windows XP Access 2003
    Join Date
    May 2011
    Posts
    15
    select L4, L3, L5, sum(NET_DR), sum(NET_CR)

    from [

    SELECT L4, L3, L5, IIf([DR]>[CR],[DR]-[CR],0) NET_DR, IIf([CR]>[DR],[CR]-[DR],0) NET_CR;
    FROM T_RB
    WHERE L4 not in (0)
    GROUP BY L4, L3, L5, IIf([DR]>[CR],[DR]-[CR],0), IIf([CR]>[DR],[CR]-[DR],0)

    ]

    GROUP BY L4, L3, L5.


    I tried this too, says invalid bracketing of name.

  3. #3
    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,848
    In my view the
    [sum(DR)]
    (andothers) is being treated as a field name.
    In Access field names containing special characters or space must be enclosed in square brackets [..].
    Are DR, CR columns in table T_RB?

    Can you describe in plain English what calculation and what result you want to display?

  4. #4
    suverman is offline Novice
    Windows XP Access 2003
    Join Date
    May 2011
    Posts
    15
    So what it is,

    I have lot of records with fields CODE, DR and CR.
    There can be same codes in different records.
    Firstly, need to sum all the individual codes sum(DR), sum(CR)
    Now, the summed sum(DR) and sum(CR) for each codes need to be net.
    NET(DR) field = if sum(dr) > sum (cr), sum(dr) - sum(cr), 0
    NET(CR) field = if sum(cr) > sum (dr), sum(cr) - sum(cr), 0


    In the end, the result should be individual codes with total net dr / net credit

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

Similar Threads

  1. problems please help
    By stryder09 in forum Access
    Replies: 1
    Last Post: 02-15-2011, 02:24 PM
  2. Problems with export
    By bbshriver in forum Import/Export Data
    Replies: 8
    Last Post: 10-30-2010, 06:16 PM
  3. Several problems
    By Bergh in forum Access
    Replies: 1
    Last Post: 05-30-2010, 03:56 AM
  4. OLE problems how to fix
    By miziri in forum Access
    Replies: 7
    Last Post: 04-29-2010, 06:18 AM
  5. Relationship problems????
    By geoffishere in forum Access
    Replies: 6
    Last Post: 02-07-2010, 04:01 PM

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