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  

Adding two subtotals together.



 
 
Thread Tools Display Modes
  #1  
Old July 21st, 2009, 09:15 PM posted to microsoft.public.access.forms
Flopbot
external usenet poster
 
Posts: 60
Default Adding two subtotals together.

I have a Subform with multiple columns in it. One column is calculated and
is subtotaled in the Form Footer. Another column is used to log any extra
hours worked by a volunteer that day. It too is being subtotaled in the Form
Footer.

Here are the two subtotals:

=Sum((DateDiff("n",[Start Time],[End Time])/60)*[Number of People])

=Sum([Other Hours])

I want to add these two subtotals together in a control box on the main form
so I can see at a glance the total number of hours volunteered by each
individual volunteer.


This is one of my failed attempts which results in “The expression you
entered contains invalid syntax.”:

=(([Volunteer Hours Subform]!Subtotal)+Nz([Extra Hours]))+(([Volunteer Hours
Subform]!Subtotal Other Hours)+Nz([Extra Hours]))

Any ideas? Thanks!

  #2  
Old July 22nd, 2009, 04:08 AM posted to microsoft.public.access.forms
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default Adding two subtotals together.

What is: [Extra Hours] where did it come from?

Try:

=(([Forms]![YourMainFormName]![Volunteer Hours
Subform].Form!Subtotal)+Nz([Extra
Hours]))+(([Forms]![YourMainFormName]![Volunteer Hours
Subform].Form!Subtotal Other Hours)+Nz([Extra Hours]))

I left [Extra Hours] in, but you may not get an accurate total.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Flopbot" wrote in message
...
I have a Subform with multiple columns in it. One column is calculated and
is subtotaled in the Form Footer. Another column is used to log any extra
hours worked by a volunteer that day. It too is being subtotaled in the
Form
Footer.

Here are the two subtotals:

=Sum((DateDiff("n",[Start Time],[End Time])/60)*[Number of People])

=Sum([Other Hours])

I want to add these two subtotals together in a control box on the main
form
so I can see at a glance the total number of hours volunteered by each
individual volunteer.


This is one of my failed attempts which results in "The expression you
entered contains invalid syntax.":

=(([Volunteer Hours Subform]!Subtotal)+Nz([Extra Hours]))+(([Volunteer
Hours
Subform]!Subtotal Other Hours)+Nz([Extra Hours]))

Any ideas? Thanks!



  #3  
Old July 23rd, 2009, 12:05 AM posted to microsoft.public.access.forms
Flopbot
external usenet poster
 
Posts: 60
Default Adding two subtotals together.

Thanks Arvin! Your comment about [Extra Hours] made me realize that I could
completely get rid of that function. It will be redundant now and in the
process it lets me get rid of a really annoying rogue field in an unrelated
table.

It works! I had to slightly modify yours by adding [ ] around the Subtotals
& Nz() around each section and it works like a charm. Here’s my final.
Thanks!

=Nz((Forms![Active Volunteer Frm]![Volunteer Hours
Subform].Form!Subtotal))+Nz((Forms![Active Volunteer Frm]![Volunteer Hours
Subform].Form![Subtotal Other Hours]))




"Arvin Meyer [MVP]" wrote:

What is: [Extra Hours] where did it come from?

Try:

=(([Forms]![YourMainFormName]![Volunteer Hours
Subform].Form!Subtotal)+Nz([Extra
Hours]))+(([Forms]![YourMainFormName]![Volunteer Hours
Subform].Form!Subtotal Other Hours)+Nz([Extra Hours]))

I left [Extra Hours] in, but you may not get an accurate total.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Flopbot" wrote in message
...
I have a Subform with multiple columns in it. One column is calculated and
is subtotaled in the Form Footer. Another column is used to log any extra
hours worked by a volunteer that day. It too is being subtotaled in the
Form
Footer.

Here are the two subtotals:

=Sum((DateDiff("n",[Start Time],[End Time])/60)*[Number of People])

=Sum([Other Hours])

I want to add these two subtotals together in a control box on the main
form
so I can see at a glance the total number of hours volunteered by each
individual volunteer.


This is one of my failed attempts which results in "The expression you
entered contains invalid syntax.":

=(([Volunteer Hours Subform]!Subtotal)+Nz([Extra Hours]))+(([Volunteer
Hours
Subform]!Subtotal Other Hours)+Nz([Extra Hours]))

Any ideas? 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 09:44 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.