Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Calculated fields are doubled.
Word 2000 & 2003. We've got form fields with bookmark names, like Fee and
Expenses. Even a simple calc like =Gross-(Fee+Expenses+TotalDeductions) I am sure I've seen this before working a helpdesk, but I don't remember the answer. If you like, you can have a look at the file he http://www.myexpertsonline.com/downloads/calcs.doc There is no code in the document. Thanks very much! ******************* ~Anne Troy www.OfficeArticles.com |
#2
|
|||
|
|||
It's because when the calculation looks at a form field like your 'Total
Deductions' it runs the contents of that form field again thus doubling its result. You can get the correct answer in your form by doing something like =Gross-(Gross*Contingency)-CostsAdvanced-Postage-Copies-Telephone-Administrative-FinanceCharges-Amount1-Amount2-Amount3-Amount4. Personally I would use a macro that runs as you exit each form field and recalculates everything: Sub calcmacro() Dim x As Double Dim y As Double Dim tot As Double x=0 y=0 tot=0 x=Val(ActiveDocument.FormFields("Val1").Result) y=Val(ActiveDocument.FormFields("Val2").Result) tot=x+y ActiveDocument.FormFields("Total").Result=tot End Sub The above macro will total two form fields bookmarked Val1 and Val2 and put the answer in the form field bookmarked Total. Set the calcmacro to run on exiting every form field. The form fields must be of a number or text type (the Val function will make it work even on text fields but currency doesn't work). The Val part also deals with any rounding problems you may get from adding taxes so your total is the expected answer. Andrea Jones http://www.allaboutoffice.co.uk http://www.stratatraining.co.uk http://www.allaboutclait.com "Anne Troy" wrote: Word 2000 & 2003. We've got form fields with bookmark names, like Fee and Expenses. Even a simple calc like =Gross-(Fee+Expenses+TotalDeductions) I am sure I've seen this before working a helpdesk, but I don't remember the answer. If you like, you can have a look at the file he http://www.myexpertsonline.com/downloads/calcs.doc There is no code in the document. Thanks very much! ******************* ~Anne Troy www.OfficeArticles.com |
#3
|
|||
|
|||
In a formfield calculation, you cannot use a formfield that contains the
result of another calculation. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Anne Troy" wrote in message ... Word 2000 & 2003. We've got form fields with bookmark names, like Fee and Expenses. Even a simple calc like =Gross-(Fee+Expenses+TotalDeductions) I am sure I've seen this before working a helpdesk, but I don't remember the answer. If you like, you can have a look at the file he http://www.myexpertsonline.com/downloads/calcs.doc There is no code in the document. Thanks very much! ******************* ~Anne Troy www.OfficeArticles.com |
#4
|
|||
|
|||
THAT's the answer I wanted. Thanks!!
******************* ~Anne Troy www.OfficeArticles.com "Doug Robbins" wrote in message ... In a formfield calculation, you cannot use a formfield that contains the result of another calculation. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Anne Troy" wrote in message ... Word 2000 & 2003. We've got form fields with bookmark names, like Fee and Expenses. Even a simple calc like =Gross-(Fee+Expenses+TotalDeductions) I am sure I've seen this before working a helpdesk, but I don't remember the answer. If you like, you can have a look at the file he http://www.myexpertsonline.com/downloads/calcs.doc There is no code in the document. Thanks very much! ******************* ~Anne Troy www.OfficeArticles.com |
#5
|
|||
|
|||
Thanks, Andrea. I will make this suggestion to the person that asked.
******************* ~Anne Troy www.OfficeArticles.com "Andrea Jones" wrote in message ... It's because when the calculation looks at a form field like your 'Total Deductions' it runs the contents of that form field again thus doubling its result. You can get the correct answer in your form by doing something like =Gross-(Gross*Contingency)-CostsAdvanced-Postage-Copies-Telephone-Administra tive-FinanceCharges-Amount1-Amount2-Amount3-Amount4. Personally I would use a macro that runs as you exit each form field and recalculates everything: Sub calcmacro() Dim x As Double Dim y As Double Dim tot As Double x=0 y=0 tot=0 x=Val(ActiveDocument.FormFields("Val1").Result) y=Val(ActiveDocument.FormFields("Val2").Result) tot=x+y ActiveDocument.FormFields("Total").Result=tot End Sub The above macro will total two form fields bookmarked Val1 and Val2 and put the answer in the form field bookmarked Total. Set the calcmacro to run on exiting every form field. The form fields must be of a number or text type (the Val function will make it work even on text fields but currency doesn't work). The Val part also deals with any rounding problems you may get from adding taxes so your total is the expected answer. Andrea Jones http://www.allaboutoffice.co.uk http://www.stratatraining.co.uk http://www.allaboutclait.com "Anne Troy" wrote: Word 2000 & 2003. We've got form fields with bookmark names, like Fee and Expenses. Even a simple calc like =Gross-(Fee+Expenses+TotalDeductions) I am sure I've seen this before working a helpdesk, but I don't remember the answer. If you like, you can have a look at the file he http://www.myexpertsonline.com/downloads/calcs.doc There is no code in the document. Thanks very much! ******************* ~Anne Troy www.OfficeArticles.com |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Having multiple form fields automatically updated | Microsoft Word Help | |||
Custom Fields in Word 2002 (XP) | Microsoft Word Help | |||
Attempting to auto-update fields in a word document | Microsoft Word Help | |||
Using MAILMERGE fields within HYPERLINK fields for Merge to Email | Mailmerge | |||
posting data from text input fields to fields later in document | Microsoft Word Help |