Summation of columns-1

P

Prem Kumar

Hi

Iam having a table "Invoices_Processed". The table has two fields "Qty",
"Rate", & "Amount". "Amount" is derived by multiplying the qty with the
rate. Now i need the summation of qty and Amount exactly underneath the last
column of the output of the query. Is there a way out?

(I dont want to create any reports and I prefer to use the query option only)
 
B

BruceM

What's wrong with using a report? It would do exactly what you need with
very little effort. If you don't want to do that, a spreadsheet may be
better suited than Access to the task.
It may be possible to create a query and a totals query, then combine the
two in another query. I have not attempted that, as Access already provides
the necessary tools for this task. If it is possible it is far more work
than using a report or form, and would not have any formatting options other
than global ones.
In any case, it is best to calculate Amount as needed rather than storing
the value.
 
P

Prem Kumar

Ok Bruce... I take your suggestion... Pls. tell me how to do that using a
report
 
A

a a r o n _ k e m p f

yes, using 'Cube' or 'ROllup' operators on the group by clause will
allow you to get subtotals / totals.

Select Count(O.*) as OrderCount, O.SalesPerson
From Orders O
Group by O.SalesPerson WITH ROLLUP

(or cube, I can't keep it straight).

This will do exactly what you are asking for.

-Aaron
 
P

Prem Kumar

Hi Aaron

Iam new to Ms-Access and am using the 2003 version. I dont see the Rollup
or Cube function in the group by option. Can you please give me the select
query based on the example that i had given.

Sorry for the trouble
 
B

BruceM

There is an option to create a report using the wizard. You could try that,
but from what I have seen it does a lot of unnecessary stuff.

In the database window (the window that appears when you first open a
database), click the Reports tab. Select "Create report by using wizard" if
you want to give that a try. Otherwise click "Create report in Design
view". It may be worthwhile using the wizard just to see how the various
formulas and so forth are used to determine the totals.

I can't walk you through the entire process from scratch, but here is a
summary if you are using desgn view. When you create a report in design
view you will see a blank report and a property sheet with tabs for Format,
Date, etc. Click the Data tab and select your table. A field list will
appear. Drag the Qty and Rate fields from the field list onto the Detail
section. Click View >> Toolbox if you do not already see the toolbox.
Click the Text Box icon, and draw a text box on the report. Click the text
box to select it, then click View >> Properties (or use the Properties icon
on the toolbar). On the Data tab, enter the following as the Control
Source:
=[Qty] * [Rate]

Click View on the menu bar, and select Report Header and Footer. Draw
another text box in the report footer (be sure it is the report footer, not
the page footer), and add the following Control Source:
=Sum([Qty] * [Rate])

Click View >> Sorting and Grouping. Select the field(s) on which you wish
to sort the data.

For more description it may be worthwhile to go to:
http://allenbrowne.com/casu-22.html

Also, there is lots of information here:
http://allenbrowne.com/tips.html

and links to many more sources of information here:
http://allenbrowne.com/links.html
 
A

a a r o n _ k e m p f

you really need to get a clue

you probably can't even spell SQL, huh?

how ****ing dare you spread false information. ADP is the most popular
format in 2002 / 2003
 

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