DSum Glitch

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pixie
    New Member
    • Sep 2006
    • 41

    DSum Glitch

    Hi. I'm having problems with the following DSum in my report footer. It gives me #Error when I run the report. I hope someone can help me out as I am at my wits end. What I am trying to do is to create a total budget which is revenues - expenses - expenses in-direct. Those controls are in the detail section of the report as groups. Here is the code.

    =DSum("[Sum of Total Budget]","qrySummaryRe port","[Type] = 'Revenues'")-DSum("[Sum of Total Budget]","qrySummaryRe port","[Type] = 'Expenses In-direct'")-DSum("[Sum of Total Budget]","qrySummaryRe port","[Type] = 'Expenses'")
  • PEB
    Recognized Expert Top Contributor
    • Aug 2006
    • 1418

    #2
    Hi,

    Try to do this:

    =nz(DSum("[Sum of Total Budget]","qrySummaryRe port","[Type] = 'Revenues'"))-nz(DSum("[Sum of Total Budget]","qrySummaryRe port","[Type] = 'Expenses In-direct'"))-nz(DSum("[Sum of Total Budget]","qrySummaryRe port","[Type] = 'Expenses'"))

    :)

    Originally posted by pixie
    Hi. I'm having problems with the following DSum in my report footer. It gives me #Error when I run the report. I hope someone can help me out as I am at my wits end. What I am trying to do is to create a total budget which is revenues - expenses - expenses in-direct. Those controls are in the detail section of the report as groups. Here is the code.

    =DSum("[Sum of Total Budget]","qrySummaryRe port","[Type] = 'Revenues'")-DSum("[Sum of Total Budget]","qrySummaryRe port","[Type] = 'Expenses In-direct'")-DSum("[Sum of Total Budget]","qrySummaryRe port","[Type] = 'Expenses'")

    Comment

    • pixie
      New Member
      • Sep 2006
      • 41

      #3
      Thanks for the suggestion but that gives me an #Error message too. Any other ideas would be appreciated!

      Comment

      • PEB
        Recognized Expert Top Contributor
        • Aug 2006
        • 1418

        #4
        Hey
        try separetly
        nz(DSum("[Sum of Total Budget]","qrySummaryRe port","[Type] = 'Revenues'"))

        then

        nz(DSum("[Sum of Total Budget]","qrySummaryRe port","[Type] = 'Expenses In-direct'"))

        and

        nz(DSum("[Sum of Total Budget]","qrySummaryRe port","[Type] = 'Expenses'"))

        and see the results!

        What kind of result it gives and where?

        :)

        Comment

        • pixie
          New Member
          • Sep 2006
          • 41

          #5
          Thanks again but I am still getting an #error message. I'm using =Sum(IIf) expressions, which work, but really want to figure out what is wrong with the DSum so any other thoughts would be great appreciated. Is there a rating on this site?

          Comment

          • PEB
            Recognized Expert Top Contributor
            • Aug 2006
            • 1418

            #6
            So,

            qrySummaryRepor t is the name of a query or of your report?

            If it is name of Report - so error...

            If it is a parametred query - so error...

            DSUM works only with tables and queries out of the current record source...

            Your solution is better than using Dsum..

            About the rating you can express your opinion in Community longe dicussions...


            Have a nice day...

            :)

            Comment

            • pixie
              New Member
              • Sep 2006
              • 41

              #7
              Ah ha! It is a 5 parameter query. I never knew that about DSum. Thanks ever so much.

              Comment

              Working...