How do I create a calculated field in a query

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

Guest

I want to add amounts from all records in a query.

For example, each record has a field called "Amount". I want the sum of all
these amounts. Can I do this in a query?
 
Try something like

Select Sum([FieldName]) As NewFieldName From TableName

You can copy and paste this SQL to your query, just change the query name
and field name
 
In query design view, pull down the Amount field.
Then go up to View, Totals.
Back down under Amount change Group By to Sum.
 
Select Sum( [Check Amount] ) As SUM From [FRS Outstanding checks bank 7
01AUG06]

What's wrong with this syntax?

Ofer Cohen said:
Try something like

Select Sum([FieldName]) As NewFieldName From TableName

You can copy and paste this SQL to your query, just change the query name
and field name

--
Good Luck
BS"D


Patty Stoddard said:
I want to add amounts from all records in a query.

For example, each record has a field called "Amount". I want the sum of all
these amounts. Can I do this in a query?
 
What is the error you getting?

--
Good Luck
BS"D


Patty Stoddard said:
Select Sum( [Check Amount] ) As SUM From [FRS Outstanding checks bank 7
01AUG06]

What's wrong with this syntax?

Ofer Cohen said:
Try something like

Select Sum([FieldName]) As NewFieldName From TableName

You can copy and paste this SQL to your query, just change the query name
and field name

--
Good Luck
BS"D


Patty Stoddard said:
I want to add amounts from all records in a query.

For example, each record has a field called "Amount". I want the sum of all
these amounts. Can I do this in a query?
 
Seems like a homework question in that a lot of folks have the exact same
table, filed, and requirement.
 
Select Sum( [Check Amount] ) As SUM From [FRS Outstanding checks bank 7
01AUG06]

What's wrong with this syntax?

Using the reserved word SUM as a fieldname, for one thing.

John W. Vinson [MVP]
 
The word SUM is a reserved word in Access SQL. Try replacint that as
the alias of the column or surround Sum with [].

SELECT Sum([Check Amount]) as [Sum] ...

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================


Patty said:
Select Sum( [Check Amount] ) As SUM From [FRS Outstanding checks bank 7
01AUG06]

What's wrong with this syntax?

Ofer Cohen said:
Try something like

Select Sum([FieldName]) As NewFieldName From TableName

You can copy and paste this SQL to your query, just change the query name
and field name

--
Good Luck
BS"D


Patty Stoddard said:
I want to add amounts from all records in a query.

For example, each record has a field called "Amount". I want the sum of all
these amounts. Can I do this in a 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

Back
Top