Simple SUM: 3 columns – error

C

Confused87

I have three columns I want to add in my query. I want a total per row of
these three:

Funds Received 1 || Funds Received 2 || Funds Received 3 || Total Raised

Here is what it looks like in the field heading:

Total Raised: Sum([Funds Recieved 1]+[Funds Recieved 2]+[Funds Recieved 3])

(Yes, I know it is spelt wrong, but it would now take too long to change!)

The error box I get when I try to go to Datasheet View is this:

“You tried to execute a query that does not include the specified expression
‘Runner’ as part of an aggregate function.â€

‘Runner’ is one of my other fields, yet it is a field for the runner’s name(
for marathons by the way). I put it in a second time and the following
message appeared:

“You tried to execute a query that does not include the specified
expression ‘Expr1000’ as part of an aggregate function.â€

Now I’m completely muddled. Does anyone know what is going on!?
 
G

golfinray

You need to hit the E button on the icons and group be everything except your
sum and use sum on it.
 
H

Hans Up

Confused87 said:
I have three columns I want to add in my query. I want a total per row of
these three:

Funds Received 1 || Funds Received 2 || Funds Received 3 || Total Raised

Here is what it looks like in the field heading:

Total Raised: Sum([Funds Recieved 1]+[Funds Recieved 2]+[Funds Recieved 3])

You can include a field expression to sum the columns. In SQL View, it
would look like this:

[Funds Recieved 1]+[Funds Recieved 2]+[Funds Recieved 3] AS [Total Raised]

However, your table design deserves a rethink. For example, if runners
ever sign up 4 sponsors, you would need to add a fourth column, "Funds
Received 4". Then modify queries and forms which reference that table.

If you want to tackle this relationally, you can break out the
contributions into a separate table with one row for each of the
runner's contributions.
 
K

KARL DEWEY

Try this ---
Total Raised: Nz([Funds Recieved 1],0)+Nz([Funds Recieved 2],0)+Nz([Funds
Recieved 3],0)
 
J

John W. Vinson

I have three columns I want to add in my query. I want a total per row of
these three:

Funds Received 1 || Funds Received 2 || Funds Received 3 || Total Raised

Here is what it looks like in the field heading:

Total Raised: Sum([Funds Recieved 1]+[Funds Recieved 2]+[Funds Recieved 3])

(Yes, I know it is spelt wrong, but it would now take too long to change!)

The error box I get when I try to go to Datasheet View is this:

“You tried to execute a query that does not include the specified expression
‘Runner’ as part of an aggregate function.”

‘Runner’ is one of my other fields, yet it is a field for the runner’s name(
for marathons by the way). I put it in a second time and the following
message appeared:

“You tried to execute a query that does not include the specified
expression ‘Expr1000’ as part of an aggregate function.”

Now I’m completely muddled. Does anyone know what is going on!?

Not without seeing the query, no; please open it in SQL view and post it here.

I agree strongly with Karl's suggestion that a rethink of your table structure
is needed. Repeating fields will cause you no end of problems.
 

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