A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

how sum a column in the same query based in a criteria?



 
 
Thread Tools Display Modes
  #1  
Old October 24th, 2008, 07:41 PM posted to microsoft.public.access
ldiaz
external usenet poster
 
Posts: 201
Default how sum a column in the same query based in a criteria?


I have query named: "qry_WOProduced" and shows datas like this,
but I would like a column to sum "QtyProd" by each "Work_OrderN" and show
them in the column "TotalProdbyWO", can you please help?

Work_OrderN QtyProd STD_Rate [TotalProdbyWO]
12545 10 STD-25 30
12545 20 STD-25 30
12548 12 STD-25 24
12548 12 STD-25 24
12545 10 STD-25 10

Thanks
LD
--
Lorenzo DÃ*az
Cad Technician
  #2  
Old October 24th, 2008, 07:57 PM posted to microsoft.public.access
Klatuu[_3_]
external usenet poster
 
Posts: 396
Default how sum a column in the same query based in a criteria?

A simple totals query
Work_OrderN - Group By
QtyProd - GroupBy
STD_Rate - GroupBy
TotalProdbyWO - Sum - This would be a calculated field tha would be nothing
more that a repeatition of QtyProd (If I understand your request correctly)

"ldiaz" wrote in message
...

I have query named: "qry_WOProduced" and shows datas like this,
but I would like a column to sum "QtyProd" by each "Work_OrderN" and show
them in the column "TotalProdbyWO", can you please help?

Work_OrderN QtyProd STD_Rate [TotalProdbyWO]
12545 10 STD-25 30
12545 20 STD-25 30
12548 12 STD-25 24
12548 12 STD-25 24
12545 10 STD-25 10

Thanks
LD
--
Lorenzo Díaz
Cad Technician



  #3  
Old October 24th, 2008, 09:42 PM posted to microsoft.public.access
ldiaz
external usenet poster
 
Posts: 201
Default how sum a column in the same query based in a criteria?

that does not work because I'm using that query linked to a subform for data
entry..

could you please help please.
--
Lorenzo DÃ*az
Cad Technician


"Klatuu" wrote:

A simple totals query
Work_OrderN - Group By
QtyProd - GroupBy
STD_Rate - GroupBy
TotalProdbyWO - Sum - This would be a calculated field tha would be nothing
more that a repeatition of QtyProd (If I understand your request correctly)

"ldiaz" wrote in message
...

I have query named: "qry_WOProduced" and shows datas like this,
but I would like a column to sum "QtyProd" by each "Work_OrderN" and show
them in the column "TotalProdbyWO", can you please help?

Work_OrderN QtyProd STD_Rate [TotalProdbyWO]
12545 10 STD-25 30
12545 20 STD-25 30
12548 12 STD-25 24
12548 12 STD-25 24
12545 10 STD-25 10

Thanks
LD
--
Lorenzo DÃ*az
Cad Technician




  #4  
Old October 24th, 2008, 10:33 PM posted to microsoft.public.access
Ken Sheridan
external usenet poster
 
Posts: 3,433
Default how sum a column in the same query based in a criteria?

Lorenzo:

Surprising as it may seem, it is possible to refer to the same query in a
DSum function call in the query. In query design view put the following (all
as one line) in the 'field' row of a blank column:

TotalProdbyWOSum("QtyProd", "qry_WOProduced", "Work_OrderN = " &
[Work_OrderN])

That assumes Work_OrderN is a number data type, If its text data type use:

TotalProdbyWOSum("QtyProd", "qry_WOProduced", "Work_OrderN = """ &
[Work_OrderN] & """")

Ken Sheridan
Stafford, England

"ldiaz" wrote:

that does not work because I'm using that query linked to a subform for data
entry..

could you please help please.
--
Lorenzo DÃ*az
Cad Technician


"Klatuu" wrote:

A simple totals query
Work_OrderN - Group By
QtyProd - GroupBy
STD_Rate - GroupBy
TotalProdbyWO - Sum - This would be a calculated field tha would be nothing
more that a repeatition of QtyProd (If I understand your request correctly)

"ldiaz" wrote in message
...

I have query named: "qry_WOProduced" and shows datas like this,
but I would like a column to sum "QtyProd" by each "Work_OrderN" and show
them in the column "TotalProdbyWO", can you please help?

Work_OrderN QtyProd STD_Rate [TotalProdbyWO]
12545 10 STD-25 30
12545 20 STD-25 30
12548 12 STD-25 24
12548 12 STD-25 24
12545 10 STD-25 10

Thanks
LD
--
Lorenzo DÃ*az
Cad Technician





  #5  
Old October 25th, 2008, 03:40 PM posted to microsoft.public.access
ldiaz
external usenet poster
 
Posts: 201
Default how sum a column in the same query based in a criteria?


that works fine..

Thanks Ken.
--
Lorenzo DÃ*az
Cad Technician


"Ken Sheridan" wrote:

Lorenzo:

Surprising as it may seem, it is possible to refer to the same query in a
DSum function call in the query. In query design view put the following (all
as one line) in the 'field' row of a blank column:

TotalProdbyWOSum("QtyProd", "qry_WOProduced", "Work_OrderN = " &
[Work_OrderN])

That assumes Work_OrderN is a number data type, If its text data type use:

TotalProdbyWOSum("QtyProd", "qry_WOProduced", "Work_OrderN = """ &
[Work_OrderN] & """")

Ken Sheridan
Stafford, England

"ldiaz" wrote:

that does not work because I'm using that query linked to a subform for data
entry..

could you please help please.
--
Lorenzo DÃ*az
Cad Technician


"Klatuu" wrote:

A simple totals query
Work_OrderN - Group By
QtyProd - GroupBy
STD_Rate - GroupBy
TotalProdbyWO - Sum - This would be a calculated field tha would be nothing
more that a repeatition of QtyProd (If I understand your request correctly)

"ldiaz" wrote in message
...

I have query named: "qry_WOProduced" and shows datas like this,
but I would like a column to sum "QtyProd" by each "Work_OrderN" and show
them in the column "TotalProdbyWO", can you please help?

Work_OrderN QtyProd STD_Rate [TotalProdbyWO]
12545 10 STD-25 30
12545 20 STD-25 30
12548 12 STD-25 24
12548 12 STD-25 24
12545 10 STD-25 10

Thanks
LD
--
Lorenzo DÃ*az
Cad Technician




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:31 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.