WORD TABLE FORMULAS Forms

B

BigWylie1

I have created a form with multiple tables.
In table "C", the user has the option to select check box "option 1" for
$59.99 or Check box 'option 2' for $100.

In Table "e" I want to create a formula, ( I think it will be an IF/Then,)
which will read which option (1 OR 2, but not both) has been selected in
table 'C' and return either a '$59.99' value or a '$100.00' value in Table
E-Cell A2 depending on which check box was selected.

I hope I have been clear. I also hope that Table 'C' does not have to be
connected to table 'E' in order to pull a reference from table 'C'.

Can anybody help???
Thank you.
 
D

Doug Robbins

Are these FormField type checkboxes?

If so, I would put another text formfield in Cell A2 of table E and use the
following code in macros that run on exit from each of the checkboxes, that
are assumed to have the bookmark name of Check1 and Check2, while the text
formfield is assumed to have the name of Text1

On exit from Check1, use:

If ActiveDocument.Formfields("Check1").Checkbox.Value = True then
ActiveDocument.Formfields("Check2").CheckBox.Value = False
ActiveDocument.Formfields("Text1").Result = "$59.99"
Else
ActiveDocument.Formfields("Check2").CheckBox.Value = True
ActiveDocument.Formfields("Text1").Result = "$100.00"
End if

On exit from Check2, use:

If ActiveDocument.Formfields("Check2").Checkbox.Value = True then
ActiveDocument.Formfields("Check1").CheckBox.Value = False
ActiveDocument.Formfields("Text1").Result = "$100.00"
Else
ActiveDocument.Formfields("Check1").CheckBox.Value = True
ActiveDocument.Formfields("Text1").Result = "$59.99"
End if

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 
B

BigWylie1

Sorry this is not clear enough.
I tried to duplicate the MAcro but when I complete this I can no longer
protect the entire document as a Form. That is the purpose of this form?

why have you included "activeDocument.formfields" before the brackets? is
this required?and why "checkbox.value" after the Bookmark references?

Should the formula in the TEXT1 CELL( I bookmarked it 'Subtotal') look like
this:

IF CHECK1=True then
CHECK2=false
TEXT1="$59.99"
ELSE
CHECK2=True then
TEXT1="$100.00"
End IF
 
D

Doug Robbins

There is nothing in the macro that will prevent you from protecting the
document for forms.

The code is written the way that it is because that is the required syntax.

I had not tried it when I posted it, but I have now and it does work.

See the article "What do I do with macros sent to me by other newsgroup
readers to help me out?" at:

http://word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm


--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 

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