#1
|
|||
|
|||
Expanding tables with calculating form fields?
Hi,
I figured out how to make calculating form fields using these instructions. Now, I'm modifying a form I created to have expanding table rows using "Repeating Section Content Control" under the Developer tab in MS Word 2013. I would like each expanded table row to have form fields that can be totaled. Right now, the fields in the row have unique bookmarks that are used to calculated a total. If I expand the table row, the new fields don't have bookmarks. Does anyone know if there's a way to make this work? |
#2
|
||||
|
||||
The link you supplied relates to formfields, which are entirely different from content controls. You need to be aware that calculation formfields are buggy when taking inputs from other calculating formfields.
To see how to do a wide range of maths calculations in Word, check out my Microsoft Word Field Maths Tutorial, at: http://windowssecrets.com/forums/sho...Maths-Tutorial or: http://www.gmayor.com/downloads.htm#Third_party To see how to do about everything you might want to do with date calculations in Word, check out my Microsoft Word Date Calculation Tutorial, at: http://windowssecrets.com/forums/sho...ation-Tutorial or: http://www.gmayor.com/downloads.htm#Third_party Do read the document's introductory material. As for adding table rows in a document using formfields, see: https://www.msofficeforums.com/word-...html#post38312
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Sweet. Thank you.
Before I dive into those links/tutorials... I was using Legacy Forms controls. I just replaced a lot of the drop downs and text fields with the current versions. I didn't do that with the fields that have the calculations. I'm wondering, before I start messing with it any further, is there a way to have conditions so that if I select something from a drop-down menu, it'll populate other fields. Here is the form I'm referring to https://drive.google.com/open?id=0B9...zUtenBveEZoNE0 The form is protected but there's no password (just leave it blank). Right now I have it set up where I put the numbers in manually and it calculates the totals. What I'd like to do is be able to select something from the drop-downs under Nomenclature and have it populate the Item N.E.W. field with a number. Then when I put in QTY, it'll calculate the TOTAL N.E.W. Is that possible? Or am I asking too much of Word and should be doing this in something more dynamic like Acrobat? I did try this once as an Adobe form, but there are other pages that have functions that I don't think Acrobat offers like inserting photos. I'm assuming the expanding tables option isn't possible, but ideally, I'd only like to have rows when I need them and not have a bunch of empties (clutter). |
#4
|
||||
|
||||
Quote:
https://www.msofficeforums.com/word/...html#post46429 https://www.msofficeforums.com/word/...html#post88302 https://www.msofficeforums.com/word/...html#post74823 You might also be interested in the formfield conditional formatting solution in: https://www.msofficeforums.com/word-...html#post47254 I've already provided you with a link for that.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Sweet. I"ll be checking it out all. Thank you so much!!!
|
#6
|
|||
|
|||
Crap... so I should have stuck with Form Fields rather than convert everything to Content Controls.
One of the reasons I thought using the content controls would be better is that for drop downs it still allows you to enter other words into the field. Can normal form fields do this as well? I also did it because some of the information I was putting in normal form fields was getting cut short. That might have been more a result of the table cell size they were on and I was blaming the fields. So you mentioned that form fields don't work well with content controls. Is that in general terms on or only when you're trying to relate/connect one type with the other? For my sample, if I use form fields for the calculating fields but left the control control fields for the static information in other parts of form, will it cause problems? Quote:
|
#7
|
||||
|
||||
Quote:
Quote:
Quote:
Quote:
I don't understand what you mean about removing comments - there is no need to remove comments from the macro code. They are never executed; they just explain things. They also have no connection with table bookmarks.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
Quote:
' If you need the formfields named, activate the commented-out code. Perhaps I didn't use the right terms. I did that for: 'For Each FmFld In .FormFields 'StrNms = StrNms & "|" & Left(FmFld.Name, Len(FmFld.Name) - 2) & Format(i, "00") 'Next and '.Select 'With Dialogs(wdDialogFormFieldOptions) '.Name = Split(StrNms, "|")(i) '.Execute 'End With Right now I'm doing the stuff in the DropDownDemo.doc. It's pretty labor intensive. So, when using that, whatever number I have set to a certain drop-down, can that number be used for a calculation? |
#9
|
||||
|
||||
Not only a number but text, too, can be used for the IF condition in a calculation.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
|||
|
|||
Is there a way to make a text field {FORMTEXT} appear through an IF condition?
If I select "other" in a drop down, to allow an empty form field to appear to input a number. For the calculations, I was originally using bookmarks for the field. With the drop down example the numbers generated from the IF condition don't have a bookmark associated with them. What do you put in place of a bookmark for expressions from those numbers? For FormFields - Table Row Add.doc example - When I run this macro in another document with nested tables I get this error Microsoft Visual Basic for Applications "X Cannot access individual rows in this collection because the table has vertically merged cells." The nested table doesn't have any merged cells so I'm not sure how to fix this. Current version of form attached. |
#11
|
||||
|
||||
Quote:
Alternatively, to simulate a combobox, see: https://www.msofficeforums.com/17071-post2.html Quote:
Quote:
PS: It would be preferred for you to attach files here, rather than linking to them on another site. You can do that via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#12
|
|||
|
|||
Quote:
Dept = { FORMDROPDOWN } {IF{REF Dropdown1 \* MERGEFORMAT}= "HR" "001"} When the number, in this case 001, is generated by the IF condition, how do you use that number in a calculation/formula? The "001" has no bookmark to use in another formula. What would be the reference? I tried just using the same formula and adding the calculation into it {={IF{REF Dropdown1 \* MERGEFORMAT}= "HR" "001"}*(REF UXOQTY1}} but it doesn't work. In my form I want the N.E.W. (from the selection made in Dropdown UXONomen01) * UXOQTY1 to be calculated and shown in the TOTAL N.E.W. Since the TOTAL N.E.W. textfield relies on bookmarks to do a calculation (right?), I'm guessing it would have to be done outside of the field's properties. I'm not sure how else to explain what I'm trying to do here. Quote:
|
#13
|
||||
|
||||
The form in post #10 doesn't include a Dropdown with a bookmark named Dropdown1, or one with either an "HR" or "001" option, so it's difficult to know exactly what you're doing. That said, the calculation field you refer to would be expressed as:
{IF{REF Dropdown1}= "HR" {REF UXOQTY1}} as there is no multiplication required. PS: I note that, despite my advice against it, your form contains both content controls and formfields.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#14
|
|||
|
|||
Quote:
Quote:
|
#15
|
|||
|
|||
I'm trying to do a similar condition formula where it displays coordinates.
It's not showing them right though. In the formula it's written "8°42'59.8"N 167°43'07.9"E" It's displayed as N9°23'33.7NN Is there a way to force it to show something exactly how it's written in the code? |
Tags |
calculating values, expanding table, form fields |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to keep formatted form fields after mail merge or replace text with formatted form fields | jer85 | Word VBA | 2 | 04-05-2015 10:00 PM |
Tables with form fields | step10 | Word | 18 | 11-12-2013 02:27 PM |
Enable editing in expanding fields | marweste | Word | 11 | 10-21-2013 07:41 AM |
How to prevent Tables from expanding | HappyFingers | Word | 1 | 11-29-2010 01:54 PM |
Calculating Form Fields in Microsoft Word | wubba80 | Word | 1 | 06-25-2010 12:42 AM |