calculated fields

S

sophie

I am developing a database which will carry customers
billing information.
There are 2 tables: Customers and Orders

I need to run a query that will tell me the number of
outstanding debts and the amounts each customer has. I
know how to get the total amount of outstanding debts
using a calculated field [total]-[payments].

What i want the next query to do is to count the total
nubmer of calculated fields (as above) that are over 0 -
this field will tell me how many unpaid orders each
custoemr has. Ie. they have "x" number of outstanding
payments.

thanks.
 
E

Eric Butts [MSFT]

Hi Sophie,

You can use a GroupBy query that has for the WHERE clause where whatever
the field is > 0.

Then use Count for whatever column.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights

--------------------
| Content-Class: urn:content-classes:message
| From: "sophie" <[email protected]>
| Sender: "sophie" <[email protected]>
| Subject: calculated fields
| Date: Tue, 9 Mar 2004 14:00:37 -0800
| Lines: 16
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcQGIfRvvK3Pp90qQVS+He1aUXohgg==
| Newsgroups: microsoft.public.access.queries
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.queries:193032
| NNTP-Posting-Host: tk2msftngxa12.phx.gbl 10.40.1.164
| X-Tomcat-NG: microsoft.public.access.queries
|
| I am developing a database which will carry customers
| billing information.
| There are 2 tables: Customers and Orders
|
| I need to run a query that will tell me the number of
| outstanding debts and the amounts each customer has. I
| know how to get the total amount of outstanding debts
| using a calculated field [total]-[payments].
|
| What i want the next query to do is to count the total
| nubmer of calculated fields (as above) that are over 0 -
| this field will tell me how many unpaid orders each
| custoemr has. Ie. they have "x" number of outstanding
| payments.
|
| thanks.
|
 
A

Allen Browne

You can type the calcuation into the Field row of a query, i.e.:
[total]-[payments]

In the Criteria row under this calculated field, enter:
Is Null Or <> 0
to retrieve those without a zero balance.

For more help on working with calculated fields, see:
http://allenbrowne.com/casu-14.html
 

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