Specified Expression/Aggregate Funciton error

D

dab1477

I am recieving the following error:
"You tried to execute a query thaty does not include the specified
expression 'Part Number' as part of an aggregate expression"
I am attempting to calculate the the expression
Expr1:sum(3600/[tbl_currentStateMaster]![CS_Cycle_Time]) within a query that
pulls from a master table.
The master table has multiple inputs by date for a specific part number -
meaning the date and part number may be repeated within the table. I do have
a column titled Tool Number that is non-repeating for each Part number.
Each Part Number may have up to 6 Tool numbers each, such that I have the
following in my master table:
Part number Tool Number Cycle time
80257 1 48
80257 2 48
80257 3 56
90218 5 32
I am trying to calculate the above initial expression for each Tool Number
within each Part Number.

What causes the agggregate expression error noted above? What would the
query need to look like in order to have the expression calculate for EACH
tool Number within EACH Part Number?

I want to see:
Part Number Tool Number Expr 1

Where Expr 1 = sum(3600/Cycle time)

Thanks in advance for your direction.
Stumped newbie,

Dab1477
 
G

golfinray

Usually if you try to group by and use max or sum in the same query it gives
that error. You are trying to group and sum at the same time. Separate it
into 2 queries.
 
D

dab1477

SELECT Tbl_CurrentStateMaster.Date, Tbl_CurrentStateMaster.[Part Number],
Tbl_CurrentStateMaster.CS_Tool_Number,
Sum(3600/Tbl_CurrentStateMaster!CS_Cycle_Time) AS Expr1
FROM Tbl_CurrentStateMaster
ORDER BY Tbl_CurrentStateMaster.[Part Number];

Thanks for your help in advance
 
K

KARL DEWEY

Try this --
SELECT Tbl_CurrentStateMaster.Date, Tbl_CurrentStateMaster.[Part Number],
Tbl_CurrentStateMaster.CS_Tool_Number,
(3600/[Tbl_CurrentStateMaster].[CS_Cycle_Time]) AS Expr1
FROM Tbl_CurrentStateMaster
ORDER BY Tbl_CurrentStateMaster.[Part Number];

You should not have field named 'Date' as that is a reserved word.

dab1477 said:
SELECT Tbl_CurrentStateMaster.Date, Tbl_CurrentStateMaster.[Part Number],
Tbl_CurrentStateMaster.CS_Tool_Number,
Sum(3600/Tbl_CurrentStateMaster!CS_Cycle_Time) AS Expr1
FROM Tbl_CurrentStateMaster
ORDER BY Tbl_CurrentStateMaster.[Part Number];

Thanks for your help in advance

KARL DEWEY said:
Post the SQL of your query.
 
D

dab1477

Thank you. Worked.

KARL DEWEY said:
Try this --
SELECT Tbl_CurrentStateMaster.Date, Tbl_CurrentStateMaster.[Part Number],
Tbl_CurrentStateMaster.CS_Tool_Number,
(3600/[Tbl_CurrentStateMaster].[CS_Cycle_Time]) AS Expr1
FROM Tbl_CurrentStateMaster
ORDER BY Tbl_CurrentStateMaster.[Part Number];

You should not have field named 'Date' as that is a reserved word.

dab1477 said:
SELECT Tbl_CurrentStateMaster.Date, Tbl_CurrentStateMaster.[Part Number],
Tbl_CurrentStateMaster.CS_Tool_Number,
Sum(3600/Tbl_CurrentStateMaster!CS_Cycle_Time) AS Expr1
FROM Tbl_CurrentStateMaster
ORDER BY Tbl_CurrentStateMaster.[Part Number];

Thanks for your help in advance

KARL DEWEY said:
Post the SQL of your query.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top