Form Page In Word and Auto Calculate

M

Mr. Mike

I created a form page but can't figure out how to auto add a table of
numbers. For example, I have 2 text fields of type number and number format
is in dollars (this can be in any number format). I bookmarked each field as
NUMB1 and NUMB2. Now in a 3rd text field I created, bookmarked as SUM, I want
to have the sum of NUMB1 + NUMB2. I tried to define the text field as
Caclulation, the Expression as "=NUMB1+NUMB2" and the Number format as
dollars. When I test out the form page I can enter in values in NUMB1 and
NUMB2 but SUM always has $0.00 and never changes. I tried checking Calculate
on exit and that did not have any affect.

My Question is do I need to do anything else and what?

Does this require a macro and where can I go to learn how to write a macro
to do this and other things?
 
M

macropod

Hi Mike,

Delete the existing formfield that you're using for the calculation and do this instead:
.. press Ctrl-F9 to create a blank field
.. type "=NUMB1+NUMB2" between the field braces, so that you end up with "{=NUMB1+NUMB2}"
.. add any formatting switches you need (see Word's help file)
.. protect & use your form.

Cheers
 
M

Mr. Mike

This is not working

First I tried creating a new field as you said and that did not work. Once I
clicked Enforcing Protection the field disappeared and never showed any
results when I defined NUMB1 and NUMB2. I tried to go back even after I
removed Enforce Protection.

Second, I tried what you said and the went to Word Help and got the following:
Add a formatting switch to a field code
1. Right-click the field, and then click Edit Field.
I tried this but there was not option "Edit Field" anywhere in the popup
menu, not even faded out. What am I doing wrong and what do I need to do to
get this to work?

macropod said:
Hi Mike,

Delete the existing formfield that you're using for the calculation and do this instead:
.. press Ctrl-F9 to create a blank field
.. type "=NUMB1+NUMB2" between the field braces, so that you end up with "{=NUMB1+NUMB2}"
.. add any formatting switches you need (see Word's help file)
.. protect & use your form.

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

Mr. Mike said:
I created a form page but can't figure out how to auto add a table of
numbers. For example, I have 2 text fields of type number and number format
is in dollars (this can be in any number format). I bookmarked each field as
NUMB1 and NUMB2. Now in a 3rd text field I created, bookmarked as SUM, I want
to have the sum of NUMB1 + NUMB2. I tried to define the text field as
Caclulation, the Expression as "=NUMB1+NUMB2" and the Number format as
dollars. When I test out the form page I can enter in values in NUMB1 and
NUMB2 but SUM always has $0.00 and never changes. I tried checking Calculate
on exit and that did not have any affect.

My Question is do I need to do anything else and what?

Does this require a macro and where can I go to learn how to write a macro
to do this and other things?
 
M

macropod

Hi Mike,

Did you have the 'calculate on exit' of both formfields checked?

As for setting the switches, you can do this without using Edit|Field. Simply select the field and press Shift-F9 to expose it's
code. If you want to add $ formatting to the formula field, edit the code so that you end up with "{=NUMB1+NUMB2 \# $,0.00}". This
will give you dollars and cents with a thousands separator. To get the same formatting with the formfields, use a number Type and
make the number format $#,##0.00.

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

Mr. Mike said:
This is not working

First I tried creating a new field as you said and that did not work. Once I
clicked Enforcing Protection the field disappeared and never showed any
results when I defined NUMB1 and NUMB2. I tried to go back even after I
removed Enforce Protection.

Second, I tried what you said and the went to Word Help and got the following:
Add a formatting switch to a field code
1. Right-click the field, and then click Edit Field.
I tried this but there was not option "Edit Field" anywhere in the popup
menu, not even faded out. What am I doing wrong and what do I need to do to
get this to work?

macropod said:
Hi Mike,

Delete the existing formfield that you're using for the calculation and do this instead:
.. press Ctrl-F9 to create a blank field
.. type "=NUMB1+NUMB2" between the field braces, so that you end up with "{=NUMB1+NUMB2}"
.. add any formatting switches you need (see Word's help file)
.. protect & use your form.

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

Mr. Mike said:
I created a form page but can't figure out how to auto add a table of
numbers. For example, I have 2 text fields of type number and number format
is in dollars (this can be in any number format). I bookmarked each field as
NUMB1 and NUMB2. Now in a 3rd text field I created, bookmarked as SUM, I want
to have the sum of NUMB1 + NUMB2. I tried to define the text field as
Caclulation, the Expression as "=NUMB1+NUMB2" and the Number format as
dollars. When I test out the form page I can enter in values in NUMB1 and
NUMB2 but SUM always has $0.00 and never changes. I tried checking Calculate
on exit and that did not have any affect.

My Question is do I need to do anything else and what?

Does this require a macro and where can I go to learn how to write a macro
to do this and other things?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top