| Home | Forums | Reviews | Articles | Register |
![]() |
| Thread Tools | Rate Thread |
|
|
|
| |
|
macropod
Guest
Posts: n/a
|
Hi kmewing,
First off, make sure you're using the 'legacy' dropdown formfields. Next, with each dropdown formfield, make sure its properties include a bookmark name (eg DropDown1, DropDown2, DropDown3, DropDown4,) and that it is set to 'calculate on exit'. Then, where you want the calculation to go, press Ctrl-F9 to create a formula field coded as: {=DropDown1+DropDown2+DropDown3+DropDown4} You can also add formatting switches to the formula field - eg: {=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)} for whole numbers, with brackets around negative values {=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00} for currency with a thousands separator -- Cheers macropod [MVP - Microsoft Word] "kmewing" <(E-Mail Removed)> wrote in message news:1431742B-35E4-465C-8414-(E-Mail Removed)... >I did a search of the forum on this topic and didn’t find anything that > answered my question. > > I’m using Word 2007 but this also needs to work with 2003. I am revamping a > form that uses text form fields. Several of the fields are drop-downs where > you can choose a number (1, 2, 3, or 4). Another field is supposed to sum > the numbers from all the drop-downs. > > I cannot get this operation to work. No matter how I configure the text > fields, the summation field just says zero. > > Here’s how I’ve configured things. First, the drop-downs (assume three) are > just created normally (default settings). Second, the summation field is > configured as follows (in the Text Form Field Options dialog box): > > Type: Calculation > Expression: =Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bookmark3 > Maximum length: Unlimited (default value) > All other fields blank. > “Calculate on exit” is selected. > > A colleague did some hacking and got the summation to work by making the > following changes in the Text Form Field Options dialog box: > > Change the drop-downs to regular text form fields and set the Type to > Number. > In the summation field, enclose the Expression in parentheses, as in: > =(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3) > In the summation field, clear the text in the Bookmark field. > > I could go this route, but I would prefer to keep the drop-downs if > possible. Does anyone have any advice? Thanks. > |
|
||
|
||||
|
kmewing
Guest
Posts: n/a
|
Thanks for the suggestions. I set up the file exactly as you described but I
still get the same behavior. The result field just shows zero regardless of what values are entered into the drop-downs. "macropod" wrote: > Hi kmewing, > > First off, make sure you're using the 'legacy' dropdown formfields. > > Next, with each dropdown formfield, make sure its properties include a bookmark name (eg DropDown1, DropDown2, DropDown3, > DropDown4,) and that it is set to 'calculate on exit'. > > Then, where you want the calculation to go, press Ctrl-F9 to create a formula field coded as: > {=DropDown1+DropDown2+DropDown3+DropDown4} > > You can also add formatting switches to the formula field - eg: > {=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)} > for whole numbers, with brackets around negative values > {=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00} > for currency with a thousands separator > > -- > Cheers > macropod > [MVP - Microsoft Word] > > > "kmewing" <(E-Mail Removed)> wrote in message news:1431742B-35E4-465C-8414-(E-Mail Removed)... > >I did a search of the forum on this topic and didn’t find anything that > > answered my question. > > > > I’m using Word 2007 but this also needs to work with 2003. I am revamping a > > form that uses text form fields. Several of the fields are drop-downs where > > you can choose a number (1, 2, 3, or 4). Another field is supposed to sum > > the numbers from all the drop-downs. > > > > I cannot get this operation to work. No matter how I configure the text > > fields, the summation field just says zero. > > > > Here’s how I’ve configured things. First, the drop-downs (assume three) are > > just created normally (default settings). Second, the summation field is > > configured as follows (in the Text Form Field Options dialog box): > > > > Type: Calculation > > Expression: =Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bookmark3 > > Maximum length: Unlimited (default value) > > All other fields blank. > > “Calculate on exit” is selected. > > > > A colleague did some hacking and got the summation to work by making the > > following changes in the Text Form Field Options dialog box: > > > > Change the drop-downs to regular text form fields and set the Type to > > Number. > > In the summation field, enclose the Expression in parentheses, as in: > > =(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3) > > In the summation field, clear the text in the Bookmark field. > > > > I could go this route, but I would prefer to keep the drop-downs if > > possible. Does anyone have any advice? Thanks. > > > > |
|
||
|
||||
|
macropod
Guest
Posts: n/a
|
Hi kmewing,
Have you protected the document for forms? If so, and you've follwed the previous directions exactly, it should work. The only other thing I can think of that would prevent it working is if you've got mergefields (for a mailmerge) embedded in the same document. -- Cheers macropod [MVP - Microsoft Word] "kmewing" <(E-Mail Removed)> wrote in message news:06B86097-3985-40E6-9260-(E-Mail Removed)... > Thanks for the suggestions. I set up the file exactly as you described but I > still get the same behavior. The result field just shows zero regardless of > what values are entered into the drop-downs. > > > "macropod" wrote: > >> Hi kmewing, >> >> First off, make sure you're using the 'legacy' dropdown formfields. >> >> Next, with each dropdown formfield, make sure its properties include a bookmark name (eg DropDown1, DropDown2, DropDown3, >> DropDown4,) and that it is set to 'calculate on exit'. >> >> Then, where you want the calculation to go, press Ctrl-F9 to create a formula field coded as: >> {=DropDown1+DropDown2+DropDown3+DropDown4} >> >> You can also add formatting switches to the formula field - eg: >> {=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)} >> for whole numbers, with brackets around negative values >> {=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00} >> for currency with a thousands separator >> >> -- >> Cheers >> macropod >> [MVP - Microsoft Word] >> >> >> "kmewing" <(E-Mail Removed)> wrote in message news:1431742B-35E4-465C-8414-(E-Mail Removed)... >> >I did a search of the forum on this topic and didn’t find anything that >> > answered my question. >> > >> > I’m using Word 2007 but this also needs to work with 2003. I am revamping a >> > form that uses text form fields. Several of the fields are drop-downs where >> > you can choose a number (1, 2, 3, or 4). Another field is supposed to sum >> > the numbers from all the drop-downs. >> > >> > I cannot get this operation to work. No matter how I configure the text >> > fields, the summation field just says zero. >> > >> > Here’s how I’ve configured things. First, the drop-downs (assume three) are >> > just created normally (default settings). Second, the summation field is >> > configured as follows (in the Text Form Field Options dialog box): >> > >> > Type: Calculation >> > Expression: =Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bookmark3 >> > Maximum length: Unlimited (default value) >> > All other fields blank. >> > “Calculate on exit” is selected. >> > >> > A colleague did some hacking and got the summation to work by making the >> > following changes in the Text Form Field Options dialog box: >> > >> > Change the drop-downs to regular text form fields and set the Type to >> > Number. >> > In the summation field, enclose the Expression in parentheses, as in: >> > =(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3) >> > In the summation field, clear the text in the Bookmark field. >> > >> > I could go this route, but I would prefer to keep the drop-downs if >> > possible. Does anyone have any advice? Thanks. >> > >> >> |
|
||
|
||||
|
kmewing
Guest
Posts: n/a
|
Yes, I enabled protection. In fact, I created a test document just to test
this functionality. I opened a pristine new document, and the only text I inserted is the text form fields, so there is no other text or functionality embedded in this document to interfere. There must be a reason why this isn't working but I just don't see it. At the very least, this discussion has shown that the problem is not due to some glaring, obvious omission. Thanks for your time nonetheless. Ken "macropod" wrote: > Hi kmewing, > > Have you protected the document for forms? If so, and you've follwed the previous directions exactly, it should work. The only other > thing I can think of that would prevent it working is if you've got mergefields (for a mailmerge) embedded in the same document. > > -- > Cheers > macropod > [MVP - Microsoft Word] > > > "kmewing" <(E-Mail Removed)> wrote in message news:06B86097-3985-40E6-9260-(E-Mail Removed)... > > Thanks for the suggestions. I set up the file exactly as you described but I > > still get the same behavior. The result field just shows zero regardless of > > what values are entered into the drop-downs. > > > > > > "macropod" wrote: > > > >> Hi kmewing, > >> > >> First off, make sure you're using the 'legacy' dropdown formfields. > >> > >> Next, with each dropdown formfield, make sure its properties include a bookmark name (eg DropDown1, DropDown2, DropDown3, > >> DropDown4,) and that it is set to 'calculate on exit'. > >> > >> Then, where you want the calculation to go, press Ctrl-F9 to create a formula field coded as: > >> {=DropDown1+DropDown2+DropDown3+DropDown4} > >> > >> You can also add formatting switches to the formula field - eg: > >> {=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)} > >> for whole numbers, with brackets around negative values > >> {=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00} > >> for currency with a thousands separator > >> > >> -- > >> Cheers > >> macropod > >> [MVP - Microsoft Word] > >> > >> > >> "kmewing" <(E-Mail Removed)> wrote in message news:1431742B-35E4-465C-8414-(E-Mail Removed)... > >> >I did a search of the forum on this topic and didn’t find anything that > >> > answered my question. > >> > > >> > I’m using Word 2007 but this also needs to work with 2003. I am revamping a > >> > form that uses text form fields. Several of the fields are drop-downs where > >> > you can choose a number (1, 2, 3, or 4). Another field is supposed to sum > >> > the numbers from all the drop-downs. > >> > > >> > I cannot get this operation to work. No matter how I configure the text > >> > fields, the summation field just says zero. > >> > > >> > Here’s how I’ve configured things. First, the drop-downs (assume three) are > >> > just created normally (default settings). Second, the summation field is > >> > configured as follows (in the Text Form Field Options dialog box): > >> > > >> > Type: Calculation > >> > Expression: =Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bookmark3 > >> > Maximum length: Unlimited (default value) > >> > All other fields blank. > >> > “Calculate on exit” is selected. > >> > > >> > A colleague did some hacking and got the summation to work by making the > >> > following changes in the Text Form Field Options dialog box: > >> > > >> > Change the drop-downs to regular text form fields and set the Type to > >> > Number. > >> > In the summation field, enclose the Expression in parentheses, as in: > >> > =(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3) > >> > In the summation field, clear the text in the Bookmark field. > >> > > >> > I could go this route, but I would prefer to keep the drop-downs if > >> > possible. Does anyone have any advice? Thanks. > >> > > >> > >> > > |
|
||
|
||||
|
Doug Robbins - Word MVP
Guest
Posts: n/a
|
You cannot do calculations directly with DropDown formfields, but must use a
macro that runs on exit. Dim dd1 As Long, dd2 As Long With ActiveDocument dd1 = .FormFields("Dropdown1").DropDown.Value dd2 = .FormFields("Dropdown2").DropDown.Value .FormFields("Text1").result = Val(.FormFields("Dropdown1").DropDown.ListEntries(dd1).Name) + _ Val(.FormFields("Dropdown1").DropDown.ListEntries(dd2).Name) End With Make sure that your formfield that is to show the result is NOT set to a Calculation type formfield. It must be of type "Regular Text" -- 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 "kmewing" <(E-Mail Removed)> wrote in message news:34C9D1DE-69DF-4A90-909F-(E-Mail Removed)... > Yes, I enabled protection. In fact, I created a test document just to > test > this functionality. I opened a pristine new document, and the only text I > inserted is the text form fields, so there is no other text or > functionality > embedded in this document to interfere. > > There must be a reason why this isn't working but I just don't see it. At > the very least, this discussion has shown that the problem is not due to > some > glaring, obvious omission. Thanks for your time nonetheless. > > Ken > > > "macropod" wrote: > >> Hi kmewing, >> >> Have you protected the document for forms? If so, and you've follwed the >> previous directions exactly, it should work. The only other >> thing I can think of that would prevent it working is if you've got >> mergefields (for a mailmerge) embedded in the same document. >> >> -- >> Cheers >> macropod >> [MVP - Microsoft Word] >> >> >> "kmewing" <(E-Mail Removed)> wrote in message >> news:06B86097-3985-40E6-9260-(E-Mail Removed)... >> > Thanks for the suggestions. I set up the file exactly as you described >> > but I >> > still get the same behavior. The result field just shows zero >> > regardless of >> > what values are entered into the drop-downs. >> > >> > >> > "macropod" wrote: >> > >> >> Hi kmewing, >> >> >> >> First off, make sure you're using the 'legacy' dropdown formfields. >> >> >> >> Next, with each dropdown formfield, make sure its properties include a >> >> bookmark name (eg DropDown1, DropDown2, DropDown3, >> >> DropDown4,) and that it is set to 'calculate on exit'. >> >> >> >> Then, where you want the calculation to go, press Ctrl-F9 to create a >> >> formula field coded as: >> >> {=DropDown1+DropDown2+DropDown3+DropDown4} >> >> >> >> You can also add formatting switches to the formula field - eg: >> >> {=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)} >> >> for whole numbers, with brackets around negative values >> >> {=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00} >> >> for currency with a thousands separator >> >> >> >> -- >> >> Cheers >> >> macropod >> >> [MVP - Microsoft Word] >> >> >> >> >> >> "kmewing" <(E-Mail Removed)> wrote in message >> >> news:1431742B-35E4-465C-8414-(E-Mail Removed)... >> >> >I did a search of the forum on this topic and didn't find anything >> >> >that >> >> > answered my question. >> >> > >> >> > I'm using Word 2007 but this also needs to work with 2003. I am >> >> > revamping a >> >> > form that uses text form fields. Several of the fields are >> >> > drop-downs where >> >> > you can choose a number (1, 2, 3, or 4). Another field is supposed >> >> > to sum >> >> > the numbers from all the drop-downs. >> >> > >> >> > I cannot get this operation to work. No matter how I configure the >> >> > text >> >> > fields, the summation field just says zero. >> >> > >> >> > Here's how I've configured things. First, the drop-downs (assume >> >> > three) are >> >> > just created normally (default settings). Second, the summation >> >> > field is >> >> > configured as follows (in the Text Form Field Options dialog box): >> >> > >> >> > Type: Calculation >> >> > Expression: >> >> > =Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bookmark3 >> >> > Maximum length: Unlimited (default value) >> >> > All other fields blank. >> >> > "Calculate on exit" is selected. >> >> > >> >> > A colleague did some hacking and got the summation to work by making >> >> > the >> >> > following changes in the Text Form Field Options dialog box: >> >> > >> >> > Change the drop-downs to regular text form fields and set the Type >> >> > to >> >> > Number. >> >> > In the summation field, enclose the Expression in parentheses, as >> >> > in: >> >> > =(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3) >> >> > In the summation field, clear the text in the Bookmark field. >> >> > >> >> > I could go this route, but I would prefer to keep the drop-downs if >> >> > possible. Does anyone have any advice? Thanks. >> >> > >> >> >> >> >> >> |
|
||
|
||||
|
macropod
Guest
Posts: n/a
|
>You cannot do calculations directly with DropDown formfields
Oops! -- Cheers macropod [MVP - Microsoft Word] "Doug Robbins - Word MVP" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)... > You cannot do calculations directly with DropDown formfields, but must use a > macro that runs on exit. > > Dim dd1 As Long, dd2 As Long > With ActiveDocument > dd1 = .FormFields("Dropdown1").DropDown.Value > dd2 = .FormFields("Dropdown2").DropDown.Value > .FormFields("Text1").result = > Val(.FormFields("Dropdown1").DropDown.ListEntries(dd1).Name) + _ > Val(.FormFields("Dropdown1").DropDown.ListEntries(dd2).Name) > End With > > Make sure that your formfield that is to show the result is NOT set to a > Calculation type formfield. It must be of type "Regular Text" > > -- > 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 > > "kmewing" <(E-Mail Removed)> wrote in message > news:34C9D1DE-69DF-4A90-909F-(E-Mail Removed)... >> Yes, I enabled protection. In fact, I created a test document just to >> test >> this functionality. I opened a pristine new document, and the only text I >> inserted is the text form fields, so there is no other text or >> functionality >> embedded in this document to interfere. >> >> There must be a reason why this isn't working but I just don't see it. At >> the very least, this discussion has shown that the problem is not due to >> some >> glaring, obvious omission. Thanks for your time nonetheless. >> >> Ken >> >> >> "macropod" wrote: >> >>> Hi kmewing, >>> >>> Have you protected the document for forms? If so, and you've follwed the >>> previous directions exactly, it should work. The only other >>> thing I can think of that would prevent it working is if you've got >>> mergefields (for a mailmerge) embedded in the same document. >>> >>> -- >>> Cheers >>> macropod >>> [MVP - Microsoft Word] >>> >>> >>> "kmewing" <(E-Mail Removed)> wrote in message >>> news:06B86097-3985-40E6-9260-(E-Mail Removed)... >>> > Thanks for the suggestions. I set up the file exactly as you described >>> > but I >>> > still get the same behavior. The result field just shows zero >>> > regardless of >>> > what values are entered into the drop-downs. >>> > >>> > >>> > "macropod" wrote: >>> > >>> >> Hi kmewing, >>> >> >>> >> First off, make sure you're using the 'legacy' dropdown formfields. >>> >> >>> >> Next, with each dropdown formfield, make sure its properties include a >>> >> bookmark name (eg DropDown1, DropDown2, DropDown3, >>> >> DropDown4,) and that it is set to 'calculate on exit'. >>> >> >>> >> Then, where you want the calculation to go, press Ctrl-F9 to create a >>> >> formula field coded as: >>> >> {=DropDown1+DropDown2+DropDown3+DropDown4} >>> >> >>> >> You can also add formatting switches to the formula field - eg: >>> >> {=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)} >>> >> for whole numbers, with brackets around negative values >>> >> {=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00} >>> >> for currency with a thousands separator >>> >> >>> >> -- >>> >> Cheers >>> >> macropod >>> >> [MVP - Microsoft Word] >>> >> >>> >> >>> >> "kmewing" <(E-Mail Removed)> wrote in message >>> >> news:1431742B-35E4-465C-8414-(E-Mail Removed)... >>> >> >I did a search of the forum on this topic and didn't find anything >>> >> >that >>> >> > answered my question. >>> >> > >>> >> > I'm using Word 2007 but this also needs to work with 2003. I am >>> >> > revamping a >>> >> > form that uses text form fields. Several of the fields are >>> >> > drop-downs where >>> >> > you can choose a number (1, 2, 3, or 4). Another field is supposed >>> >> > to sum >>> >> > the numbers from all the drop-downs. >>> >> > >>> >> > I cannot get this operation to work. No matter how I configure the >>> >> > text >>> >> > fields, the summation field just says zero. >>> >> > >>> >> > Here's how I've configured things. First, the drop-downs (assume >>> >> > three) are >>> >> > just created normally (default settings). Second, the summation >>> >> > field is >>> >> > configured as follows (in the Text Form Field Options dialog box): >>> >> > >>> >> > Type: Calculation >>> >> > Expression: >>> >> > =Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bookmark3 >>> >> > Maximum length: Unlimited (default value) >>> >> > All other fields blank. >>> >> > "Calculate on exit" is selected. >>> >> > >>> >> > A colleague did some hacking and got the summation to work by making >>> >> > the >>> >> > following changes in the Text Form Field Options dialog box: >>> >> > >>> >> > Change the drop-downs to regular text form fields and set the Type >>> >> > to >>> >> > Number. >>> >> > In the summation field, enclose the Expression in parentheses, as >>> >> > in: >>> >> > =(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3) >>> >> > In the summation field, clear the text in the Bookmark field. >>> >> > >>> >> > I could go this route, but I would prefer to keep the drop-downs if >>> >> > possible. Does anyone have any advice? Thanks. >>> >> > >>> >> >>> >> >>> >>> > > |
|
||
|
||||
|
macropod
Guest
Posts: n/a
|
Actually, you CAN do calculations directly with DropDown formfields - I merely had the syntax wrong. It should have been:
{={REF DropDown1}+{REF DropDown2}+{REF DropDown3}+{REF DropDown4}} where the field braces (ie '{ }') are created in pairs via Ctrl-F9. -- Cheers macropod [MVP - Microsoft Word] "Doug Robbins - Word MVP" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)... > You cannot do calculations directly with DropDown formfields, but must use a > macro that runs on exit. > > Dim dd1 As Long, dd2 As Long > With ActiveDocument > dd1 = .FormFields("Dropdown1").DropDown.Value > dd2 = .FormFields("Dropdown2").DropDown.Value > .FormFields("Text1").result = > Val(.FormFields("Dropdown1").DropDown.ListEntries(dd1).Name) + _ > Val(.FormFields("Dropdown1").DropDown.ListEntries(dd2).Name) > End With > > Make sure that your formfield that is to show the result is NOT set to a > Calculation type formfield. It must be of type "Regular Text" > > -- > 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 > > "kmewing" <(E-Mail Removed)> wrote in message > news:34C9D1DE-69DF-4A90-909F-(E-Mail Removed)... >> Yes, I enabled protection. In fact, I created a test document just to >> test >> this functionality. I opened a pristine new document, and the only text I >> inserted is the text form fields, so there is no other text or >> functionality >> embedded in this document to interfere. >> >> There must be a reason why this isn't working but I just don't see it. At >> the very least, this discussion has shown that the problem is not due to >> some >> glaring, obvious omission. Thanks for your time nonetheless. >> >> Ken >> >> >> "macropod" wrote: >> >>> Hi kmewing, >>> >>> Have you protected the document for forms? If so, and you've follwed the >>> previous directions exactly, it should work. The only other >>> thing I can think of that would prevent it working is if you've got >>> mergefields (for a mailmerge) embedded in the same document. >>> >>> -- >>> Cheers >>> macropod >>> [MVP - Microsoft Word] >>> >>> >>> "kmewing" <(E-Mail Removed)> wrote in message >>> news:06B86097-3985-40E6-9260-(E-Mail Removed)... >>> > Thanks for the suggestions. I set up the file exactly as you described >>> > but I >>> > still get the same behavior. The result field just shows zero >>> > regardless of >>> > what values are entered into the drop-downs. >>> > >>> > >>> > "macropod" wrote: >>> > >>> >> Hi kmewing, >>> >> >>> >> First off, make sure you're using the 'legacy' dropdown formfields. >>> >> >>> >> Next, with each dropdown formfield, make sure its properties include a >>> >> bookmark name (eg DropDown1, DropDown2, DropDown3, >>> >> DropDown4,) and that it is set to 'calculate on exit'. >>> >> >>> >> Then, where you want the calculation to go, press Ctrl-F9 to create a >>> >> formula field coded as: >>> >> {=DropDown1+DropDown2+DropDown3+DropDown4} >>> >> >>> >> You can also add formatting switches to the formula field - eg: >>> >> {=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)} >>> >> for whole numbers, with brackets around negative values >>> >> {=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00} >>> >> for currency with a thousands separator >>> >> >>> >> -- >>> >> Cheers >>> >> macropod >>> >> [MVP - Microsoft Word] >>> >> >>> >> >>> >> "kmewing" <(E-Mail Removed)> wrote in message >>> >> news:1431742B-35E4-465C-8414-(E-Mail Removed)... >>> >> >I did a search of the forum on this topic and didn't find anything >>> >> >that >>> >> > answered my question. >>> >> > >>> >> > I'm using Word 2007 but this also needs to work with 2003. I am >>> >> > revamping a >>> >> > form that uses text form fields. Several of the fields are >>> >> > drop-downs where >>> >> > you can choose a number (1, 2, 3, or 4). Another field is supposed >>> >> > to sum >>> >> > the numbers from all the drop-downs. >>> >> > >>> >> > I cannot get this operation to work. No matter how I configure the >>> >> > text >>> >> > fields, the summation field just says zero. >>> >> > >>> >> > Here's how I've configured things. First, the drop-downs (assume >>> >> > three) are >>> >> > just created normally (default settings). Second, the summation >>> >> > field is >>> >> > configured as follows (in the Text Form Field Options dialog box): >>> >> > >>> >> > Type: Calculation >>> >> > Expression: >>> >> > =Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bookmark3 >>> >> > Maximum length: Unlimited (default value) >>> >> > All other fields blank. >>> >> > "Calculate on exit" is selected. >>> >> > >>> >> > A colleague did some hacking and got the summation to work by making >>> >> > the >>> >> > following changes in the Text Form Field Options dialog box: >>> >> > >>> >> > Change the drop-downs to regular text form fields and set the Type >>> >> > to >>> >> > Number. >>> >> > In the summation field, enclose the Expression in parentheses, as >>> >> > in: >>> >> > =(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3) >>> >> > In the summation field, clear the text in the Bookmark field. >>> >> > >>> >> > I could go this route, but I would prefer to keep the drop-downs if >>> >> > possible. Does anyone have any advice? Thanks. >>> >> > >>> >> >>> >> >>> >>> > > |
|
||
|
||||
|
Doug Robbins - Word MVP
Guest
Posts: n/a
|
Ah, but is that directly?
It's really splitting hairs, but you are using a reference to the dropdowns. Still, it is less work than a macro -- 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 "macropod" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)... > Actually, you CAN do calculations directly with DropDown formfields - I > merely had the syntax wrong. It should have been: > {={REF DropDown1}+{REF DropDown2}+{REF DropDown3}+{REF DropDown4}} > where the field braces (ie '{ }') are created in pairs via Ctrl-F9. > > -- > Cheers > macropod > [MVP - Microsoft Word] > > > "Doug Robbins - Word MVP" <(E-Mail Removed)> wrote in message > news:(E-Mail Removed)... >> You cannot do calculations directly with DropDown formfields, but must >> use a macro that runs on exit. >> >> Dim dd1 As Long, dd2 As Long >> With ActiveDocument >> dd1 = .FormFields("Dropdown1").DropDown.Value >> dd2 = .FormFields("Dropdown2").DropDown.Value >> .FormFields("Text1").result = >> Val(.FormFields("Dropdown1").DropDown.ListEntries(dd1).Name) + _ >> Val(.FormFields("Dropdown1").DropDown.ListEntries(dd2).Name) >> End With >> >> Make sure that your formfield that is to show the result is NOT set to a >> Calculation type formfield. It must be of type "Regular Text" >> >> -- >> 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 >> >> "kmewing" <(E-Mail Removed)> wrote in message >> news:34C9D1DE-69DF-4A90-909F-(E-Mail Removed)... >>> Yes, I enabled protection. In fact, I created a test document just to >>> test >>> this functionality. I opened a pristine new document, and the only text >>> I >>> inserted is the text form fields, so there is no other text or >>> functionality >>> embedded in this document to interfere. >>> >>> There must be a reason why this isn't working but I just don't see it. >>> At >>> the very least, this discussion has shown that the problem is not due to >>> some >>> glaring, obvious omission. Thanks for your time nonetheless. >>> >>> Ken >>> >>> >>> "macropod" wrote: >>> >>>> Hi kmewing, >>>> >>>> Have you protected the document for forms? If so, and you've follwed >>>> the previous directions exactly, it should work. The only other >>>> thing I can think of that would prevent it working is if you've got >>>> mergefields (for a mailmerge) embedded in the same document. >>>> >>>> -- >>>> Cheers >>>> macropod >>>> [MVP - Microsoft Word] >>>> >>>> >>>> "kmewing" <(E-Mail Removed)> wrote in message >>>> news:06B86097-3985-40E6-9260-(E-Mail Removed)... >>>> > Thanks for the suggestions. I set up the file exactly as you >>>> > described but I >>>> > still get the same behavior. The result field just shows zero >>>> > regardless of >>>> > what values are entered into the drop-downs. >>>> > >>>> > >>>> > "macropod" wrote: >>>> > >>>> >> Hi kmewing, >>>> >> >>>> >> First off, make sure you're using the 'legacy' dropdown formfields. >>>> >> >>>> >> Next, with each dropdown formfield, make sure its properties include >>>> >> a bookmark name (eg DropDown1, DropDown2, DropDown3, >>>> >> DropDown4,) and that it is set to 'calculate on exit'. >>>> >> >>>> >> Then, where you want the calculation to go, press Ctrl-F9 to create >>>> >> a formula field coded as: >>>> >> {=DropDown1+DropDown2+DropDown3+DropDown4} >>>> >> >>>> >> You can also add formatting switches to the formula field - eg: >>>> >> {=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)} >>>> >> for whole numbers, with brackets around negative values >>>> >> {=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00} >>>> >> for currency with a thousands separator >>>> >> >>>> >> -- >>>> >> Cheers >>>> >> macropod >>>> >> [MVP - Microsoft Word] >>>> >> >>>> >> >>>> >> "kmewing" <(E-Mail Removed)> wrote in message >>>> >> news:1431742B-35E4-465C-8414-(E-Mail Removed)... >>>> >> >I did a search of the forum on this topic and didn't find anything >>>> >> >that >>>> >> > answered my question. >>>> >> > >>>> >> > I'm using Word 2007 but this also needs to work with 2003. I am >>>> >> > revamping a >>>> >> > form that uses text form fields. Several of the fields are >>>> >> > drop-downs where >>>> >> > you can choose a number (1, 2, 3, or 4). Another field is >>>> >> > supposed to sum >>>> >> > the numbers from all the drop-downs. >>>> >> > >>>> >> > I cannot get this operation to work. No matter how I configure >>>> >> > the text >>>> >> > fields, the summation field just says zero. >>>> >> > >>>> >> > Here's how I've configured things. First, the drop-downs (assume >>>> >> > three) are >>>> >> > just created normally (default settings). Second, the summation >>>> >> > field is >>>> >> > configured as follows (in the Text Form Field Options dialog box): >>>> >> > >>>> >> > Type: Calculation >>>> >> > Expression: >>>> >> > =Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bookmark3 >>>> >> > Maximum length: Unlimited (default value) >>>> >> > All other fields blank. >>>> >> > "Calculate on exit" is selected. >>>> >> > >>>> >> > A colleague did some hacking and got the summation to work by >>>> >> > making the >>>> >> > following changes in the Text Form Field Options dialog box: >>>> >> > >>>> >> > Change the drop-downs to regular text form fields and set the Type >>>> >> > to >>>> >> > Number. >>>> >> > In the summation field, enclose the Expression in parentheses, as >>>> >> > in: >>>> >> > =(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3) >>>> >> > In the summation field, clear the text in the Bookmark field. >>>> >> > >>>> >> > I could go this route, but I would prefer to keep the drop-downs >>>> >> > if >>>> >> > possible. Does anyone have any advice? Thanks. >>>> >> > >>>> >> >>>> >> >>>> >>>> >> |
|
||
|
||||
|
|
|
| |
![]() |
| Thread Tools | |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Calculations in Form Fields not working | Jeff Doby | Microsoft Word Document Management | 2 | 28th Mar 2008 07:10 PM |
| Form calculations only on fields that are filled in | =?Utf-8?B?R2lsbGlhbg==?= | Microsoft Access Getting Started | 0 | 9th Mar 2007 04:38 PM |
| Calculations from Form Fields | FpwL1399 | Microsoft Access Form Coding | 13 | 27th Jun 2006 02:51 PM |
| Calculations in form fields | =?Utf-8?B?S2F0aHlITA==?= | Microsoft Word Document Management | 1 | 18th Jun 2005 01:46 PM |
| Running Calculations in fields on a form | rglasunow | Microsoft Access Form Coding | 2 | 17th Feb 2004 06:04 PM |
Powered by vBulletin®. Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2010, Crawlability, Inc. |




