View Single Post
  #10   Report Post  
Posted to microsoft.public.word.newusers
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default IF field? and if so, how to set up it??

Insert three textbox formfields into your document and a dropdown formfield
to which you add (via its properties dialog) the entries 20% and 30% and
have a macro containing the following code run on exit from the dropdown
formfield

Dim rate As Long
With ActiveDocument
If .FormFields("Dropdown1").DropDown.Value = 1 Then
rate = 20
Else
rate = 30
End If
If IsNumeric(.FormFields("Text1").Result) Then
.FormFields("Text2").Result = .FormFields("Text1").Result * rate /
100
.FormFields("Text3").Result = .FormFields("Text1").Result * (1 -
rate / 100)
Else
MsgBox "You must enter a numeric value"
End If
End With

The macro assumes that the name of the bookmark assigned to the formfield
into which the gross amount will be entered is Text1 and the amount of the
tax will be shown in the formfield Text2 and the net amount after tax will
be shown in Text3

--
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

"revolution21" wrote in message
...

Hi again

I've another difficult (for me :P) task that maybe requires an IF
field.
I've to prepare a form for a sort of income. It works this way:

gross amount = X ("Lordo")
tax 20% = Lordo/5 ("Imponibile")
net amount = Lordo - Imponibile

in this form, inserting the gross amount it's possible to know the net
amount.
I assigned a bookmark to the gross amount text field ("Lordo"), then
another one to the function to know the amount of the tax
("Imponibile"), then the final function subtracting the tax amount from
the gross amount.
The problem is: in Italy you have two different rates for taxes: one is
20% (like in the example shown), another is 30%. I would like to allow a
choice between the two tax amounts, and then I would like that the form
will be able to calculate depending on the choice of the tax amount.
Is there a way to do that?
By the way, to calculate the 30% tax amount i used this forumla:
(Lordo x 3)/10.

thanks in advance for you help!




--
revolution21