error message.

  • Thread starter Thread starter steve a
  • Start date Start date
S

steve a

Hi i'm stuggling with this error message and don't understand how to get
around it.

the error reads:
"you tried to execute a query that does not includde the expression 'time'
as part of an aggregate function."

SELECT[activity table].time, [activity table].ID, [activity table].patient,
[activity table].activity, [activity table].[reason for cancellation],
[activity table].Dept, [activity table].Staff, [activity table].Datein,
[activity table].Ward, [activity table].cost, [activity table].xtrstaff,
IIf([activity]="court apperance",30,0) AS extra, IIf([reason for
cancellation]>"",0,(Sum(([xtrstaff]*([time]/60))))+Sum(IIf([activity]="court
appearance",30,0))) AS xtrcost
FROM [activity table];


the complete SQL is as follows
 
Hi i'm stuggling with this error message and don't understand how to get
around it.

the error reads:
"you tried to execute a query that does not includde the expression 'time'
as part of an aggregate function."

SELECT[activity table].time, [activity table].ID, [activity table].patient,
[activity table].activity, [activity table].[reason for cancellation],
[activity table].Dept, [activity table].Staff, [activity table].Datein,
[activity table].Ward, [activity table].cost, [activity table].xtrstaff,
IIf([activity]="court apperance",30,0) AS extra, IIf([reason for
cancellation]>"",0,(Sum(([xtrstaff]*([time]/60))))+Sum(IIf([activity]="court
appearance",30,0))) AS xtrcost
FROM [activity table];

the complete SQL is as follows

What are you really trying to do with
Sum([xtrstaff]*([time]/60))) ?

If you are trying to sum a list of values, you need to use DSUM
here.... or do your sum inside a proper totals query and then include
that result in this query.
 
Back
Top