A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

calculating columns (fields)



 
 
Thread Tools Display Modes
  #1  
Old February 17th, 2006, 10:40 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default calculating columns (fields)

I'm trying to calculate columns (fields) in a query in Access. I have to be
able to do this to display the correct data. My table looks like this (simple
example):

ID # STATE STATUS AMOUNT
123 CA current $100.00
222 AZ delinquent $200.00
115 CA delinquent $150.00
444 AZ current $120.00
999 CA current $90.00

What I need to be able to do in a query (or table) is to calculate different
totals based on various criteria, like the total dollar amount of all
delinquent accounts in CA, or the total dollar amount of all current accounts
in AZ. Can this be done in a query or table in Access? Thanks, if anyone can
help. I have not been able to figure out how to do this.

  #2  
Old February 17th, 2006, 10:54 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default calculating columns (fields)

This can be done in a query or by using the aggregate function DSum().

Example:
DSum("Amount", "TableName", "State = 'CA' And Status = 'Current'")

will return the sum of all current records in California.

As a query, this would look like:

SELECT Sum(TableName.Amount) AS SumOfAmount
FROM TableName
WHERE (((TableName.State)='CA') AND ((TableName.Status)='current'));

--
Wayne Morgan
MS Access MVP


"Dino" wrote in message
...
I'm trying to calculate columns (fields) in a query in Access. I have to
be
able to do this to display the correct data. My table looks like this
(simple
example):

ID # STATE STATUS AMOUNT
123 CA current $100.00
222 AZ delinquent $200.00
115 CA delinquent $150.00
444 AZ current $120.00
999 CA current $90.00

What I need to be able to do in a query (or table) is to calculate
different
totals based on various criteria, like the total dollar amount of all
delinquent accounts in CA, or the total dollar amount of all current
accounts
in AZ. Can this be done in a query or table in Access? Thanks, if anyone
can
help. I have not been able to figure out how to do this.



  #3  
Old February 17th, 2006, 10:57 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default calculating columns (fields)

Yes.
Create a new query in design view, drag down STATE, STATUS, and AMOUNT fields.
Change the query to a Totals query by clicking on the icon that is the Greek
letter Epsilon on the tool bar.
The grid will chage so that the third row is label Total:
Change the Group By under AMOUNT column to SUM.

Save and run the query.

"Dino" wrote:

I'm trying to calculate columns (fields) in a query in Access. I have to be
able to do this to display the correct data. My table looks like this (simple
example):

ID # STATE STATUS AMOUNT
123 CA current $100.00
222 AZ delinquent $200.00
115 CA delinquent $150.00
444 AZ current $120.00
999 CA current $90.00

What I need to be able to do in a query (or table) is to calculate different
totals based on various criteria, like the total dollar amount of all
delinquent accounts in CA, or the total dollar amount of all current accounts
in AZ. Can this be done in a query or table in Access? Thanks, if anyone can
help. I have not been able to figure out how to do this.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to compare text fields in 2 different columns in excel ljt1 Worksheet Functions 2 January 31st, 2006 11:22 PM
Adding custom fields as columns in the current view Simon Gray Contacts 1 January 18th, 2006 04:59 PM
Calculating total fields? ptlm65 Running & Setting Up Queries 3 December 21st, 2005 01:46 PM
restrict fields or columns CBC General Discussion 1 November 23rd, 2005 11:47 PM
Fields - Columns Bill Worksheet Functions 3 September 7th, 2004 08:36 AM


All times are GMT +1. The time now is 04:27 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.