UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Simple Form Calculation?, Office 2007    
 
   
flashit
post Mar 3 2012, 05:09 AM
Post #1

UtterAccess Member
Posts: 22



Hi All,

I have created an input form for a quote/invoice system, it's a continuous form with what I see as simple calcs within it BUT...it's never that simple. Basically, the form cals the value & qty per line & thats fine, but I cannot get it to ttal all the lines as a "sum".

I've attached images showing what i'm doing (wrong i guess) but thought this would work.

When I have looked at other sample DB's this does appear to be how it's done, so where have I gone wrong?

Any help appreciated






Attached File(s)
Attached File  page_total.jpg ( 79.19K ) Number of downloads: 28
Attached File  page_total_error.jpg ( 54.99K ) Number of downloads: 20
 
Go to the top of the page
 
+
Peter46
post Mar 3 2012, 05:18 AM
Post #2

UtterAccess VIP
Posts: 7,394
From: Oadby Leics, UK



qty should be Quantity
Go to the top of the page
 
+
flashit
post Mar 3 2012, 06:09 AM
Post #3

UtterAccess Member
Posts: 22



cheers Peter,

Both where wrong but you could not see that from the image uploaded. Sure I tried that yesterday along with 1000 other ways incl queries and the like.

But sorted thanks

Go to the top of the page
 
+
missinglinq
post Mar 3 2012, 08:42 PM
Post #4

UtterAccess Ruler
Posts: 2,656



Aggregate Functions, such as Sum(), have to be run against the underlying Fields, not against the Controls displaying the Fields.

As Peter said, you need to replace Qty with Quantity and 'Price' with whatever is the Control Source for the 'Unit Price' Textbox. Your image only shows 'ProductU.' Possibly ProductUntiPrice?

Linq ;0)>
Go to the top of the page
 
+
flashit
post Mar 4 2012, 01:48 PM
Post #5

UtterAccess Member
Posts: 22



QUOTE (missinglinq @ Mar 3 2012, 08:42 PM) *
Aggregate Functions, such as Sum(), have to be run against the underlying Fields, not against the Controls displaying the Fields.

As Peter said, you need to replace Qty with Quantity and 'Price' with whatever is the Control Source for the 'Unit Price' Textbox. Your image only shows 'ProductU.' Possibly ProductUntiPrice?

Linq ;0)>


Thanks for reply

So if I understand correctly, if I use =sum([fieldA] * [fieldB]) rather than just [fieldA] * [fieldB] my approach is slightly different? I think I now understand why my now works (see attached)

My example "text boxes" use qty & quantity, qty is the the name of the text box & quantity is the control sauce of the text box.
Attached File(s)
Attached File  calcs2.jpg ( 168.38K ) Number of downloads: 2
 
Go to the top of the page
 
+
missinglinq
post Mar 4 2012, 08:23 PM
Post #6

UtterAccess Ruler
Posts: 2,656



QUOTE (flashit @ Mar 4 2012, 02:48 PM) *
...if I use =sum([fieldA] * [fieldB]) rather than just [fieldA] * [fieldB] my approach is slightly different?

Yes. Multiplying the contents of two Controls, in the same, Current Record, can be done using

Me.txtFieldA * Me.txtFieldB

because they are in the same Record and thus available. You cannot mistake which Record you're talking about; it's the Current Record.

But when you're using any of the Aggregate Functions, such as Sun(), you have to use the names of the actual Fields as they appear in the underlying Table. That's because in using Sum(), you're doing calculations that involve Multiple Records, not just a Single Record.

Linq ;0)>
Go to the top of the page
 
+
flashit
post Mar 5 2012, 02:07 AM
Post #7

UtterAccess Member
Posts: 22



Thanks Missingling,

Simple & pretty obvious well explianed in such concise detail.

I like it here.
Go to the top of the page
 
+
missinglinq
post Mar 5 2012, 08:48 AM
Post #8

UtterAccess Ruler
Posts: 2,656



Glad we could help!

Welcome to the site!

Linq ;0)>
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 20th May 2013 - 05:14 PM