Results 1 to 4 of 4
  1. #1
    JonathanT is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    118

    Dsum in a calculated field

    I am having difficulty in obtaining the correct result when using a calculated field in a report.
    Domain is a table is called "data"
    Expression is a field is called [other]. This is a YES/NO field whose underlying values are -1 and 0
    Criteria are fields called [curryear] and [quarter]

    I can get the correct results with one criteria, however when I try to combine two criteria the result is incorrect

    =DSum("[other]","data","[curryear]=2010") gives the correct result of -26

    =DSum("[other]","data","[quarter]=1") gives the correct result of -7

    =DSum("[other]","data","[curryear]=2010" And "[quarter]='1'") should

    return -7 instead it returns -27 which is a combination of all years in the "data" table.



    Any help would be appreciated

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try:
    =DSum("[other]","[data]","[curryear]=2010 And [quarter]=1")
    ...and DATA if a future Reserved word and should not be used as is.
    http://www.allenbrowne.com/AppIssueBadWord.html#D

  3. #3
    JonathanT is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    118
    Thank you very much. It worked perfectly

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Glad we could help.

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

Similar Threads

  1. Calculated Field Help
    By Alex Motilal in forum Queries
    Replies: 2
    Last Post: 01-06-2011, 04:54 AM
  2. calculated field from calculated field?
    By RedGoneWILD in forum Reports
    Replies: 5
    Last Post: 08-03-2010, 02:32 PM
  3. Calculated field
    By nashr1928 in forum Forms
    Replies: 9
    Last Post: 08-01-2010, 01:59 PM
  4. Calculated field
    By nashr1928 in forum Forms
    Replies: 3
    Last Post: 07-22-2010, 05:10 AM
  5. Replies: 1
    Last Post: 05-05-2010, 01:54 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