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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

SubTotals on Forms



 
 
Thread Tools Display Modes
  #1  
Old February 7th, 2009, 04:35 AM posted to microsoft.public.access.forms
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default SubTotals on Forms

Try this --
SELECT [Transaction - Details].[Invoice No], Sum([Transaction -
Details].[Line Amount]) AS [SumOfLine Amount]
FROM [Transaction - Details] INNER JOIN [Transaction - General] ON
[Transaction - Details].[Trans ID] = [Transaction - General].[Trans ID]
GROUP BY [Transaction - Details].[Invoice No];

--
KARL DEWEY
Build a little - Test a little


"Stacey Crowhurst" wrote:

Hi. I have a form that shows transactions (checks paid to vendors). In the
header I have the check number and check date. In the detail section I have
a subform that shows the transaction detail (i.e. invoice number, dollar
amount, account charged). I want to have two totals at the bottom of the
form: check total and invoice total. I need the distinction because often
one check will pay a vendor for two or more invoices. The check total refers
to a query and runs fine. I have the query set up for the invoice total but
it doesn't work as I'd expect.

For Example:
AAA Car Washing was paid $555 with check 2233. There are five lines of
transaction detail for that check.
1. Invoice 10 $5 labor
2. Invoice 10 $245 soap
3. Invoice 11 $5 labor
4. Invoice 11 $200 soap
5. Invoice 11 $100 fragrance
So the check total is $555; invoice 10 total is $250 and invoice 11 total is
$305.
As I click through the five lines of the subform I expect the check total to
always read $555 which it does. I expect the invoice total to read $250
until I reach line 3 when it should change to $305.

Here is the invoice total SQL:

SELECT [Transaction - General].[Check No], [Transaction - Details].[Invoice
No], Sum([Transaction - Details].[Line Amount]) AS [SumOfLine Amount]
FROM [Transaction - Details] INNER JOIN [Transaction - General] ON
[Transaction - Details].[Trans ID] = [Transaction - General].[Trans ID]
GROUP BY [Transaction - General].[Check No], [Transaction -
Details].[Invoice No];

I’m open to any suggestions you may have. Perhaps I shouldn't have totals
on my forms? Anyway, thanks!

  #2  
Old February 7th, 2009, 04:36 AM posted to microsoft.public.access.forms
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default SubTotals on Forms

I removed [Check No] as you can not use it when summing invoices.

How many queries are you using for your form and subform? It seems as
though this query was used in the details.
--
KARL DEWEY
Build a little - Test a little


"Stacey Crowhurst" wrote:

Hi Karl. I tried the SQL below and when I go to open my form it wants me to
enter the parameter value for "Check No". Any other ideas?

Thanks.
Stacey

"KARL DEWEY" wrote:

Try this --
SELECT [Transaction - Details].[Invoice No], Sum([Transaction -
Details].[Line Amount]) AS [SumOfLine Amount]
FROM [Transaction - Details] INNER JOIN [Transaction - General] ON
[Transaction - Details].[Trans ID] = [Transaction - General].[Trans ID]
GROUP BY [Transaction - Details].[Invoice No];

--
KARL DEWEY
Build a little - Test a little


"Stacey Crowhurst" wrote:

Hi. I have a form that shows transactions (checks paid to vendors). In the
header I have the check number and check date. In the detail section I have
a subform that shows the transaction detail (i.e. invoice number, dollar
amount, account charged). I want to have two totals at the bottom of the
form: check total and invoice total. I need the distinction because often
one check will pay a vendor for two or more invoices. The check total refers
to a query and runs fine. I have the query set up for the invoice total but
it doesn't work as I'd expect.

For Example:
AAA Car Washing was paid $555 with check 2233. There are five lines of
transaction detail for that check.
1. Invoice 10 $5 labor
2. Invoice 10 $245 soap
3. Invoice 11 $5 labor
4. Invoice 11 $200 soap
5. Invoice 11 $100 fragrance
So the check total is $555; invoice 10 total is $250 and invoice 11 total is
$305.
As I click through the five lines of the subform I expect the check total to
always read $555 which it does. I expect the invoice total to read $250
until I reach line 3 when it should change to $305.

Here is the invoice total SQL:

SELECT [Transaction - General].[Check No], [Transaction - Details].[Invoice
No], Sum([Transaction - Details].[Line Amount]) AS [SumOfLine Amount]
FROM [Transaction - Details] INNER JOIN [Transaction - General] ON
[Transaction - Details].[Trans ID] = [Transaction - General].[Trans ID]
GROUP BY [Transaction - General].[Check No], [Transaction -
Details].[Invoice No];

I’m open to any suggestions you may have. Perhaps I shouldn't have totals
on my forms? Anyway, thanks!

 




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


All times are GMT +1. The time now is 01:59 PM.


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