473,396 Members | 2,002 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,396 software developers and data experts.

sum or Dsum?

12
i have a textbox in a form. Where i want it to calculate the total of hours for different employees in different month.

when i use "=sum([hour])" it gives the the total of all employee in all of the monthes.
and when i use Dsum as " = DSum( "[Hour]", "[tablename]", "[MonthID]" =1)", it gives me the total of all employee in January.

my question is, what should i do to make it only calculate the total hour of only the one specific employee and one specific month.
Feb 4 '08 #1
3 5020
jaxjagfan
254 Expert 100+
i have a textbox in a form. Where i want it to calculate the total of hours for different employees in different month.

when i use "=sum([hour])" it gives the the total of all employee in all of the monthes.
and when i use Dsum as " = DSum( "[Hour]", "[tablename]", "[MonthID]" =1)", it gives me the total of all employee in January.

my question is, what should i do to make it only calculate the total hour of only the one specific employee and one specific month.
= DSum( "[Hour]", "[tablename]", "[MonthID]" =1 AND "[EmpID]" =1)

The criteria of the DSUM works just like a Where clause without "Where".
Feb 4 '08 #2
lulu123
12
hi, thanks for replying, jaxjagfan..
but, it still didn't solve my problem, i don't think i explained it clear enough...

the problem is that, this mainform has a subfrom. the main form contains employeeID, and the subform is where employee can enter their own hours and monthes....and on the main from footer, i have this textbox, where i want it calculate the total hours for each month. So, if i use " empID=1" , it will only give me value for EmployeeI , not total hours to the related employee.

i tried to make a query, it gives me the right answer.(where shows the diffeerent month total hours to related employee name). However, i dno't know how to make the result to show on my mainform ?

Do you know hwo can i solve that? Thanks.

= DSum( "[Hour]", "[tablename]", "[MonthID]" =1 AND "[EmpID]" =1)

The criteria of the DSUM works just like a Where clause without "Where".
Feb 4 '08 #3
jaxjagfan
254 Expert 100+
hi, thanks for replying, jaxjagfan..
but, it still didn't solve my problem, i don't think i explained it clear enough...

the problem is that, this mainform has a subfrom. the main form contains employeeID, and the subform is where employee can enter their own hours and monthes....and on the main from footer, i have this textbox, where i want it calculate the total hours for each month. So, if i use " empID=1" , it will only give me value for EmployeeI , not total hours to the related employee.

i tried to make a query, it gives me the right answer.(where shows the diffeerent month total hours to related employee name). However, i dno't know how to make the result to show on my mainform ?

Do you know hwo can i solve that? Thanks.
DSum( "[Hour]", "[tablename]", "[MonthID]" =1 AND "[EmpID]" = & Me.FormEmployeeIDControl)

Should be something like that. When you sum on month just remember that is All Month 1's or all January's. Make sure you include Month Year combinations at a minumum to get correct totals.
Feb 4 '08 #4

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

Similar topics

0
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....
2
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...
1
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...
4
by: John Baker | last post by:
Hi: I have a form, and wish to show on the form the current total for a single field on a table. I have set this up thus: =DSum(,!) in an unbound text field. These are correct field and table...
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...
3
by: beppe005 | last post by:
I would like to calculate a total for all the field with the same in a query. I don't know how to set the "criteria" for this dsum function, it should be something like = but it doesn't make...
1
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...
33
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...
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...
3
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,...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...

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.