473,756 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DSum Issues

8 New Member
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 is based on a query that gathers all an employee's info. In that query, I have a calculated field which gives an employee's total time on a process.

(DateDiff("n",[StartTime],[EndTime]))/60

This gives the total time in hourly fractions. Now what I'm trying to do on thre report is to total up these times but also to divide them up between which departments they belong to based on a process code. Here's where I'm running into issues. This is the Dsum functon I've been putting in the Control Source for a TextBox:

=DSum("[Time]","TimesheetQue ry","[Process#] >= 3000 And [Process#] <=3501")

This is only one variation that I have used. I'm really more of a beginner with Access and am learning through trial and error. As I've been looking at different threads trying to see what might make this work, I've tried several other variations but nothing seems to come out right.

Is it because I'm trying to sum a calculated field? Is it because I'm using the function incorrectly or entering it wrong? When I go to the report I'm getting '#Error'. Thanks again for the help
Jul 31 '08 #1
4 2039
missinglinq
3,532 Recognized Expert Specialist
I seldom use this kind of thing in my practice, but I think you've diagnosed your own problem! As best I can remember, in order to use Aggregate functions, such as DSum(), with calculated fields, you have to include the calculation expression itself, rather than just a field that holds the results of the calculation.

Also, you probably need to change the name of Process#. The # sign is used by Access to delimit dates, so a statement such as

=DSum("[Time]","TimesheetQue ry","[Process#] >= 3000 And [Process#] <=3501")

is apt to confuse the Access gnomes making them think that everything between the #'s is a date!

Welcome to Bytes!

Linq ;0)>
Jul 31 '08 #2
Adam1331
8 New Member
Ok, so I tried putting this in

=DSum("DateDiff ("n",[StartTime],[EndTime]","TimesheetQue ry","[ProcessNumber] >= 3000 And [ProcessNumber]<= 3500")

and received the error

The expression you entered contains invalid syntax
You may have entered an operand without an operator

Any advice?
Jul 31 '08 #3
Adam1331
8 New Member
Hey thanks again for the time and help missinglinq but I found a different way around the isssues by using IIF statements in the query.

Have a good one!
Jul 31 '08 #4
missinglinq
3,532 Recognized Expert Specialist
Glad you got it working!

Linq ;0)>
Jul 31 '08 #5

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

Similar topics

0
3353
by: Rolan | last post by:
I'm using Access 97 and need some assistance in sorting out a proper DSum expression, or maybe even DCount might be an alternative. I have tried numerous combinations, but with no apparent success. The DSum function relates to a subform (sfrmCost) with a text box (RefCost) which is intended to be the container for a total from a query (qryItems). The query has three number columns from the table (tblItems) of which I have an expression...
1
3965
by: Dalan | last post by:
This seems a bit odd, but I have not been able to persuade Access 97 to format several DSum total columns in Currency - Standard format. It appears to be defaulting to a general number format instead. The text box format is set to standard and so is the related query properties supplying the totals. Does anyone have any ideas as to a workaround for this issue? Thanks, Dalan
2
11593
by: Dalan | last post by:
I seemed to be having problems with structuring the use of NZ with a DSum expression. Having tried numerous variations of the expression without success, I'm asking for assistance. First some background (Access 97) - the DSum expressions are being used in grand total text boxes on the footer of a subform. And when viewing the subform in the linked main form the two grand total boxes display #Error if no entry had been made. Those with...
1
4155
by: Alex | last post by:
Acc 97 Hi, I have the following in my query which works well if it is all set to numbers on table design. But what I want to do is where it states MC (short for machine name) use the actual machine name of which there are 5 off. therefore, on the table design I flick it over to text mode.
3
3767
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 trying to do is create a subreport for the main report which gives a generalised breakdown of the main report. For the gender of 'Ladies', there may be several parea's so I want to sum the packs_req for ladies only. (Gender is not a field I can use,...
1
2175
by: gbb0330 | last post by:
Hi All i am trying to calculate Quantity on hand in a unbound textbox in a form with a subform QonHand=Qreceived - TotalQSold TotalQsold=QsoldOnEbay+QsoldThruOtherChannels here is my expression:
33
8243
by: potassium flower | last post by:
I am trying to create a food order system for a restaurant. I have tried using both the DSum and Sum functions to calculate the total cost of an order. The total cost is a textbox on the form tblOrder (and a field in tblOrder) and the list of meals along with their costs are in the tblOrderDetail Subform (the columns in this form come fromt two tables - tblOrderDetails and tblItems). I have been putting the DSum / Sum in the control...
1
3865
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 inputbox when the report opens. I then want to use the value inputted in a DSUM calculation on the same form. The hidden textbox is called tbHolddate, its control source is: =InputBox() The textbox that calculates a value using a DSUM control...
3
2075
by: majapa | last post by:
To start, here is my DSum expression: Develop: Nz(DSum(". & "] + . & "]","CSO","='Ability to Develop'")*-1,0) I actually have 4 of these, each one with a different option for . For more context, the . part is drawing from a separate reference table which cycles through plugging in the name for each DB_ and Ben_ field in the CSO table. What I want to do is add another layer of criteria, the field which exists in the same CSO table. I'd...
0
10031
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9869
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9838
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9708
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2665
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.