#1   Report Post  
Posted to microsoft.public.word.docmanagement
tony tony is offline
external usenet poster
 
Posts: 2
Default formulas

I am using word 2003 and am using text form fields in a table. I will
use my bookmark names here with a brief explanation of what I am
actually trying to accomplish, and hopefully it will make some sense
and someone could help. I can accomplish this in Excel no problem,
but Word is a different world.
Working inside the table, I am trying to get Text109 (Deposit amount
due to landlord) to calculate by taking Text112 (Deposit total) and
subtracting Text108 (total amount due to landlord) and if it is equal
to or less than zero, then show zero, but if not then show the
balance. And then I am trying to get Text110 (Rent amount due to
landlord) to calculate Text111 less Text108 (Rent total) only if
Text112 (Deposit total) is equal to or less than zero.
In other words, I would like to first apply the amount received by
landlord to first apply to the deposit and then apply to the rent and
show any overpayment as a zero balance in the deposit field and as a
credit in the rent amount due to landlord.
I am sorry if this explanation rambles.
Thank you,
Tony
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default formulas

This would work best with a macro run on exit from the last required field
Text112. If I have understood the requirement correctly then the following
should work. Uncheck the allow fill-in property for the two calculated
fields.

Sub CalcTotal()
Dim sDep As String
Dim sDue As String
Dim sRent As String
Dim sCalc1 As String
Dim sCalc2 As String

With ActiveDocument
sDep = .FormFields("Text112").Result
sDue = .FormFields("Text108").Result
sRent = .FormFields("Text111").Result

sCalc1 = sDep - sDue
If sCalc1 = 0 Then sCalc1 = 0
.FormFields("Text109").Result = sCalc1

sCalc2 = sRent - sDue
If sDep = 0 Then sCalc2 = 0
.FormFields("Text110").Result = sCalc2

End With
End Sub


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



tony wrote:
I am using word 2003 and am using text form fields in a table. I will
use my bookmark names here with a brief explanation of what I am
actually trying to accomplish, and hopefully it will make some sense
and someone could help. I can accomplish this in Excel no problem,
but Word is a different world.
Working inside the table, I am trying to get Text109 (Deposit amount
due to landlord) to calculate by taking Text112 (Deposit total) and
subtracting Text108 (total amount due to landlord) and if it is equal
to or less than zero, then show zero, but if not then show the
balance. And then I am trying to get Text110 (Rent amount due to
landlord) to calculate Text111 less Text108 (Rent total) only if
Text112 (Deposit total) is equal to or less than zero.
In other words, I would like to first apply the amount received by
landlord to first apply to the deposit and then apply to the rent and
show any overpayment as a zero balance in the deposit field and as a
credit in the rent amount due to landlord.
I am sorry if this explanation rambles.
Thank you,
Tony



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
tony tony is offline
external usenet poster
 
Posts: 2
Default formulas

On Mar 29, 2:37*am, "Graham Mayor" wrote:
This would work best with a macro run on exit from the last required field
Text112. If I have understood the requirement correctly then the following
should work. Uncheck the allow fill-in property for the two calculated
fields.

Sub CalcTotal()
Dim sDep As String
Dim sDue As String
Dim sRent As String
Dim sCalc1 As String
Dim sCalc2 As String

With ActiveDocument
* * sDep = .FormFields("Text112").Result
* * sDue = .FormFields("Text108").Result
* * sRent = .FormFields("Text111").Result

sCalc1 = sDep - sDue
* * If sCalc1 = 0 Then sCalc1 = 0
* * .FormFields("Text109").Result = sCalc1

* * *sCalc2 = sRent - sDue
* * If sDep = 0 Then sCalc2 = 0
* * .FormFields("Text110").Result = sCalc2

End With
End Sub

--

Graham Mayor - *Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org




tony wrote:
I am using word 2003 and am using text form fields in a table. *I will
use my bookmark names here with a brief explanation of what I am
actually trying to accomplish, and hopefully it will make some sense
and someone could help. *I can accomplish this in Excel no problem,
but Word is a different world.
Working inside the table, I am trying to get Text109 (Deposit amount
due to landlord) to calculate by taking Text112 (Deposit total) and
subtracting Text108 (total amount due to landlord) and if it is equal
to or less than zero, then show zero, but if not then show the
balance. And then I am trying to get Text110 (Rent amount due to
landlord) to calculate Text111 less Text108 (Rent total) only if
Text112 (Deposit total) is equal to or less than zero.
In other words, I would like to first apply the amount received by
landlord to first apply to the deposit and then apply to the rent and
show any overpayment as a zero balance in the deposit field and as a
credit in the rent amount due to landlord.
I am sorry if this explanation rambles.
Thank you,
Tony- Hide quoted text -


- Show quoted text -


I have tried the macro but I am still having trouble. If there is
some way that I could post the table itself maybe you could see it in
context and then you could show me so that it could make sense to me.
Thank you,
Tony
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
WANT TO LEARN ABOUT USING ALL FORMULAS TedCron Tables 2 November 5th 21 09:53 AM
Formulas? cbremar Mailmerge 3 June 13th 07 07:59 AM
Formulas in Tables kr Tables 1 February 20th 07 09:51 PM
Statistics & Formulas kmmh Microsoft Word Help 1 January 16th 06 09:31 PM
Formulas in a Table corkman New Users 1 September 8th 05 01:27 AM


All times are GMT +1. The time now is 05:22 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"