473,382 Members | 1,437 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

DSum function in a report

Alright you all have been so helpful with everything else that I thought I'd run one more issue by you. I have put together a report that is driven by a query. This query (Unique Records) returns all unique records in a table (DDRS Data). Each unique record is a string of elements from the table (15 different ones total) and I'm trying to get the report to sum the multiple dollar amounts that appear for each unique record. I've used the DSum function:

=DSum("Trial Balance Amount","DDRS Data","Acct = [Acct]")

where Trial Balance Amount is the field that I need to sum, DDRS Data is the table from which the dollar amounts are pulled, Acct is the field in the table, and [Acct] is the text box in the report. I keep getting a #Error message. Any idea what's wrong? Is there any more information that I can give you that would help? Thanks so much!
Oct 4 '07 #1
9 5399
TSIGOS1
24
not really sure but how can[acct] be a value on a textbox?
Oct 4 '07 #2
I thought you were supposed to put text boxes in square brackets. Could that be my problem?
Oct 4 '07 #3
mlcampeau
296 Expert 100+
Alright you all have been so helpful with everything else that I thought I'd run one more issue by you. I have put together a report that is driven by a query. This query (Unique Records) returns all unique records in a table (DDRS Data). Each unique record is a string of elements from the table (15 different ones total) and I'm trying to get the report to sum the multiple dollar amounts that appear for each unique record. I've used the DSum function:

=DSum("Trial Balance Amount","DDRS Data","Acct = [Acct]")

where Trial Balance Amount is the field that I need to sum, DDRS Data is the table from which the dollar amounts are pulled, Acct is the field in the table, and [Acct] is the text box in the report. I keep getting a #Error message. Any idea what's wrong? Is there any more information that I can give you that would help? Thanks so much!
I'm no expert on the syntax for DSum but yours definitely doesn't look right.
Try something like:
=DSum("[Trial Balance Amount]","DDRS Data", "[Acct] = "&[Acct])

If Acct isn't a number then try:
=DSum("[Trial Balance Amount]","DDRS Data", "[Acct] = '" & [Acct] &"'")
Oct 4 '07 #4
Great, that worked perfectly. I have one other follow-on issue...

I need to add additional elements to the formula to include fields like [Program Description] and [Fed], among others. Here's the formula that I put together to include [Program Description]:

=DSum("[Trial Balance Amount]","DDRS Data","[Acct] = " & [Acct] And "[Program Description) = " & [Program Description])

but it didn't work. What is wrong with the formula?

Thanks again!
Oct 4 '07 #5
mlcampeau
296 Expert 100+
Great, that worked perfectly. I have one other follow-on issue...

I need to add additional elements to the formula to include fields like [Program Description] and [Fed], among others. Here's the formula that I put together to include [Program Description]:

=DSum("[Trial Balance Amount]","DDRS Data","[Acct] = " & [Acct] And "[Program Description) = " & [Program Description])

but it didn't work. What is wrong with the formula?

Thanks again!
The trickiest part to this is knowing how/when to use single/double quotes. I'm still learning so I'm going to take a stab at this:
Expand|Select|Wrap|Line Numbers
  1. =DSum("[Trial Balance Amount]","DDRS Data", "[Acct] = " & [Acct] & " AND [Program Description]= '" & [Program Description] & "'")
(I'm assuming Program Description is a string)
Oct 4 '07 #6
You all are amazing. A new problem surfaced...

As I tried putting all 15 fields in the formula, I ran into the 2048 limit. Is there any way around this?

I swear I'm almost done with this thread.
Oct 4 '07 #7
mlcampeau
296 Expert 100+
You all are amazing. A new problem surfaced...

As I tried putting all 15 fields in the formula, I ran into the 2048 limit. Is there any way around this?

I swear I'm almost done with this thread.
To get the results you want you need to make sure that 15 fields match?? I've only used DSum with a maximum of 3 or 4 fields, so unfortunately, I don't know a way to get around this (I'm still learning a lot when it comes to Access). I also don't know what the 2048 limit is, but I'm assuming it's just not liking having 15 fields. Can you not sum the fields in your query rather than using DSum?
Oct 4 '07 #8
Yeah, I unfortunately need to sum on all 15 fields. It has to do with a line of accounting which is comprised of 15 different elements, all of which I need the total for each unique line.

As for the 2048, I'm under the impression that a formula in a text box can only be 2048 characters long. Is this correct?

As for summing in the query, I can't seem to find a way to do it. The query is based on table DDRS Data and narrows it down to all the unique lines. (Like 21-X... would be different than 21-Z...) It finds each unique line regardless of how many times it appears and lists it only once. The query is just all the fields from the table excluding the dollar amount fields. Is there a way to link it so that query Unique Records finds the sums of the lines in table DDRS Data?

If not, is there anyone out there who knows how I can get all 15 elements in my DSum formula from the previous posts?

Thanks for your continued help.
Oct 4 '07 #9
mlcampeau
296 Expert 100+
Yeah, I unfortunately need to sum on all 15 fields. It has to do with a line of accounting which is comprised of 15 different elements, all of which I need the total for each unique line.

As for the 2048, I'm under the impression that a formula in a text box can only be 2048 characters long. Is this correct?

As for summing in the query, I can't seem to find a way to do it. The query is based on table DDRS Data and narrows it down to all the unique lines. (Like 21-X... would be different than 21-Z...) It finds each unique line regardless of how many times it appears and lists it only once. The query is just all the fields from the table excluding the dollar amount fields. Is there a way to link it so that query Unique Records finds the sums of the lines in table DDRS Data?

If not, is there anyone out there who knows how I can get all 15 elements in my DSum formula from the previous posts?

Thanks for your continued help.
Why don't you create a separate query to get the sum that you want, and then you can use DLookup()? Again, I must point out that I am still learning Access and there may be an easier/more efficient way of doing this...I just don't know of one!
Oct 4 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mark Reed | last post by:
All, I have never used this function before and am not sure it what I need. Just to clarify, I have a report based on a query which has amoungst other field, wk, parea & packs_req. What I am...
4
by: John Baker | last post by:
Hi: At the bottom of a report, I wish to sum all the amounts that appear in a field called Discount$ that appears on the report. I am not doing this summing in the query that supports the report...
4
by: stephena | last post by:
Hello all, hope someone can help. I recently built a report showing the distribution of money in and out of the company. Simplified version of which looks like: DECEMBER 2004 TELEPHONE...
1
by: Marc Aube | last post by:
Is there a web site that can ofer some help. The quotation marks are posing an issue as well as other items for this function. I have some books but they are not consistent in their use of the code...
6
by: pixie | last post by:
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...
6
by: ckpoll2 | last post by:
Hi, I have made a report that has a query as its record source. I put a text box in there that I want to run a dsum function off of a different query. The criteria that I need to use is that it...
1
by: danielgoss | last post by:
Hi I have a report that has loads of textboxes that calculate things based on the value on another textbox in the report. I have put a hidden textbox on my report that gets its value from an...
13
by: ringer | last post by:
Hi, I have a text box on report where I need to have dsum return a total. The records I need the total from are not in the table that is the report's recordsource, and to complicate things...
4
by: Adam1331 | last post by:
I've been trying to get the DSum function to work but I've been running into some roadblocks. What I'm trying to do is to total up times in a timesheet report into different departments. The report...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.