more query help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

im trying to total the amounts of a field named LikelyDuration in a query.
This is the code i have:

Expr1: Sum(LikelyDuration])

this does not seem to work however. i get this error message:

"You tried to execute a query that does not include the specified expression
'AbsenceLineID' as part of an aggregate function".

What am i doing wrong?
 
SELECT tblAbsenceLine.AbsenceLineID, tblAbsenceLine.AbsenceID,
tblAbsenceLine.AbsenceReasonID, tblAbsenceLine.Date,
tblAbsenceLine.LikelyDuration, tblAbsenceLine.WorkRelated,
tblAbsenceLine.NotifiedBy, Sum([LikelyDuration]) AS Length
FROM tblAbsenceLine;


yeah, i suppose that would be useful!

Chris2 said:
Joe Robbo said:
im trying to total the amounts of a field named LikelyDuration in a query.
This is the code i have:

Expr1: Sum(LikelyDuration])

this does not seem to work however. i get this error message:

"You tried to execute a query that does not include the specified expression
'AbsenceLineID' as part of an aggregate function".

What am i doing wrong?

Joe Robbo,

Please include the SQL for the query(ies) involved.


Sincerely,

Chris O.
 
Joe Robbo said:
im trying to total the amounts of a field named LikelyDuration in a query.
This is the code i have:

Expr1: Sum(LikelyDuration])

this does not seem to work however. i get this error message:

"You tried to execute a query that does not include the specified expression
'AbsenceLineID' as part of an aggregate function".

What am i doing wrong?

Joe Robbo,

Please include the SQL for the query(ies) involved.


Sincerely,

Chris O.
 
Joe Robbo said:
Joe Robbo said:
im trying to total the amounts of a field named LikelyDuration
in a
query.
This is the code i have:

Expr1: Sum(LikelyDuration])

this does not seem to work however. i get this error message:

"You tried to execute a query that does not include the
specified
expression
'AbsenceLineID' as part of an aggregate function".

What am i doing wrong?

Joe Robbo,

Please include the SQL for the query(ies) involved.


Sincerely,

Chris O.
yeah, i suppose that would be useful!

:

Joe Robbo,

SELECT tblAbsenceLine.AbsenceLineID
,tblAbsenceLine.AbsenceID
,tblAbsenceLine.AbsenceReasonID
,tblAbsenceLine.Date
,tblAbsenceLine.LikelyDuration
,tblAbsenceLine.WorkRelated
,tblAbsenceLine.NotifiedBy
,Sum([LikelyDuration]) AS Length
FROM tblAbsenceLine;

The GROUP BY clause is missing.

Change the query to:

SELECT tblAbsenceLine.AbsenceLineID
,tblAbsenceLine.AbsenceID
,tblAbsenceLine.AbsenceReasonID
,tblAbsenceLine.Date
,tblAbsenceLine.LikelyDuration
,tblAbsenceLine.WorkRelated
,tblAbsenceLine.NotifiedBy
,Sum([LikelyDuration]) AS Length
FROM tblAbsenceLine
GROUP BY tblAbsenceLine.AbsenceLineID
,tblAbsenceLine.AbsenceID
,tblAbsenceLine.AbsenceReasonID
,tblAbsenceLine.Date
,tblAbsenceLine.LikelyDuration
,tblAbsenceLine.WorkRelated
,tblAbsenceLine.NotifiedBy;


I can't tell without your seeing the structure of your tables and the
data in them and the appearance of your expected output, but just from
the way this Query is done, I'm thinking that it won't produce the
output you are looking for (if I'm wrong, then don't worry about what
I just said).


Sincerely,

Chris O.
 
thanks, that is kindof along the lines, but it isn't actually giving me a
total. i need 1 total for the cumulative set of data. i have seen it done by
using a text box on a form before - is that the only possible way of
achieving this? or can i use a new field to make a cumulative total and then
use last(expr) to extract whatever value is there? thanks

Chris2 said:
Joe Robbo said:
im trying to total the amounts of a field named LikelyDuration in a
query.
This is the code i have:

Expr1: Sum(LikelyDuration])

this does not seem to work however. i get this error message:

"You tried to execute a query that does not include the specified
expression
'AbsenceLineID' as part of an aggregate function".

What am i doing wrong?

Joe Robbo,

Please include the SQL for the query(ies) involved.


Sincerely,

Chris O.
yeah, i suppose that would be useful!

:

Joe Robbo,

SELECT tblAbsenceLine.AbsenceLineID
,tblAbsenceLine.AbsenceID
,tblAbsenceLine.AbsenceReasonID
,tblAbsenceLine.Date
,tblAbsenceLine.LikelyDuration
,tblAbsenceLine.WorkRelated
,tblAbsenceLine.NotifiedBy
,Sum([LikelyDuration]) AS Length
FROM tblAbsenceLine;

The GROUP BY clause is missing.

Change the query to:

SELECT tblAbsenceLine.AbsenceLineID
,tblAbsenceLine.AbsenceID
,tblAbsenceLine.AbsenceReasonID
,tblAbsenceLine.Date
,tblAbsenceLine.LikelyDuration
,tblAbsenceLine.WorkRelated
,tblAbsenceLine.NotifiedBy
,Sum([LikelyDuration]) AS Length
FROM tblAbsenceLine
GROUP BY tblAbsenceLine.AbsenceLineID
,tblAbsenceLine.AbsenceID
,tblAbsenceLine.AbsenceReasonID
,tblAbsenceLine.Date
,tblAbsenceLine.LikelyDuration
,tblAbsenceLine.WorkRelated
,tblAbsenceLine.NotifiedBy;


I can't tell without your seeing the structure of your tables and the
data in them and the appearance of your expected output, but just from
the way this Query is done, I'm thinking that it won't produce the
output you are looking for (if I'm wrong, then don't worry about what
I just said).


Sincerely,

Chris O.
 
Joe Robbo said:
Joe Robbo said:
im trying to total the amounts of a field named
LikelyDuration
in a
query.
This is the code i have:

Expr1: Sum(LikelyDuration])

this does not seem to work however. i get this error message:

"You tried to execute a query that does not include the specified
expression
'AbsenceLineID' as part of an aggregate function".

What am i doing wrong?

Joe Robbo,

Please include the SQL for the query(ies) involved.


Sincerely,

Chris O.
yeah, i suppose that would be useful!

:

Joe Robbo,

SELECT tblAbsenceLine.AbsenceLineID
,tblAbsenceLine.AbsenceID
,tblAbsenceLine.AbsenceReasonID
,tblAbsenceLine.Date
,tblAbsenceLine.LikelyDuration
,tblAbsenceLine.WorkRelated
,tblAbsenceLine.NotifiedBy
,Sum([LikelyDuration]) AS Length
FROM tblAbsenceLine;

The GROUP BY clause is missing.

Change the query to:

SELECT tblAbsenceLine.AbsenceLineID
,tblAbsenceLine.AbsenceID
,tblAbsenceLine.AbsenceReasonID
,tblAbsenceLine.Date
,tblAbsenceLine.LikelyDuration
,tblAbsenceLine.WorkRelated
,tblAbsenceLine.NotifiedBy
,Sum([LikelyDuration]) AS Length
FROM tblAbsenceLine
GROUP BY tblAbsenceLine.AbsenceLineID
,tblAbsenceLine.AbsenceID
,tblAbsenceLine.AbsenceReasonID
,tblAbsenceLine.Date
,tblAbsenceLine.LikelyDuration
,tblAbsenceLine.WorkRelated
,tblAbsenceLine.NotifiedBy;


I can't tell without your seeing the structure of your tables and the
data in them and the appearance of your expected output, but just from
the way this Query is done, I'm thinking that it won't produce the
output you are looking for (if I'm wrong, then don't worry about what
I just said).


Sincerely,

Chris O.
thanks, that is kindof along the lines, but it isn't actually giving me a
total. i need 1 total for the cumulative set of data. i have seen it done by
using a text box on a form before - is that the only possible way of
achieving this? or can i use a new field to make a cumulative total and then
use last(expr) to extract whatever value is there? thanks

I refer you to my previous hint (seen above):


Sincerely,

Chris O.
 
Back
Top