Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-22-2016, 02:57 PM
Father Father is offline Expanding tables with calculating form fields? Windows 7 32bit Expanding tables with calculating form fields? Office 2013
Novice
Expanding tables with calculating form fields?
 
Join Date: Nov 2016
Posts: 29
Father is on a distinguished road
Default

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.
Attached Files
File Type: docm 2016 EOD Form Form Fields.docm (42.5 KB, 12 views)
Reply With Quote
  #2  
Old 11-22-2016, 03:22 PM
macropod's Avatar
macropod macropod is offline Expanding tables with calculating form fields? Windows 7 64bit Expanding tables with calculating form fields? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,372
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Father View Post
Is there a way to make a text field {FORMTEXT} appear through an IF condition?
No. A macro would be required for that. See: Word 2010 template form field (If checkbox is checked display another field else do not display)

Alternatively, to simulate a combobox, see: https://www.msofficeforums.com/17071-post2.html
Quote:
Originally Posted by Father View Post
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?
When you insert a dropdown formfield into a document, Word gives it a default bookmark name (e.g. Dropdown1). You can see that when you examine the formfield's properties; you can also delete it or change it to something else.
Quote:
Originally Posted by Father View Post
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.
Your table does have vertically merged cells. See item 8. Furthermore, the macro isn't designed to work with nested tables, so I don't know how you'll get along with that.

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]
Reply With Quote
  #3  
Old 11-22-2016, 06:45 PM
Father Father is offline Expanding tables with calculating form fields? Windows 7 32bit Expanding tables with calculating form fields? Office 2013
Novice
Expanding tables with calculating form fields?
 
Join Date: Nov 2016
Posts: 29
Father is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
When you insert a dropdown formfield into a document, Word gives it a default bookmark name (e.g. Dropdown1). You can see that when you examine the formfield's properties; you can also delete it or change it to something else.
I'm talking about this:
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:
Originally Posted by macropod View Post
Your table does have vertically merged cells. See item 8. Furthermore, the macro isn't designed to work with nested tables, so I don't know how you'll get along with that.
Using this I put the sample into a vertically and horizontally merged table an it still works. Not sure what the difference is between what I'm doing with the sample and my working form.
Reply With Quote
  #4  
Old 11-23-2016, 06:51 PM
macropod's Avatar
macropod macropod is offline Expanding tables with calculating form fields? Windows 7 64bit Expanding tables with calculating form fields? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,372
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Father View Post
I'm talking about this:
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?
The 001 is simply the displayed output. You don't reference that in a calculation; only whatever Dropdown1 returns. You can also lose the ' \* MERGEFORMAT' - it's quite unnecessary. So, if you want to use th, you'd code along the lines of:
{={IF{REF Dropdown1}= "Finance" 2 {IF{REF Dropdown1}= "HR" 1 0}}*5}
where 5 is whatever you want to multiply the selected item's value by. However, that's really no different than:
{IF{REF Dropdown1}= "HR" 5}{IF{REF Dropdown1}= "Finance" 10}
I suggest you take a look at my Microsoft Word Field Maths Tutorial, available at:
http://windowssecrets.com/forums/sho...Maths-Tutorial
and:
http://www.gmayor.com/downloads.htm#Third_party
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 11-29-2016, 03:41 PM
Father Father is offline Expanding tables with calculating form fields? Windows 7 32bit Expanding tables with calculating form fields? Office 2013
Novice
Expanding tables with calculating form fields?
 
Join Date: Nov 2016
Posts: 29
Father is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
I suggest you take a look at my Microsoft Word Field Maths Tutorial, available at:
http://windowssecrets.com/forums/sho...Maths-Tutorial
I'm sure a lot of it is due to the fact that I have no idea what I'm actually doing, but...

When I am in ALT-F9 view and putting in the code/formula it doesn't always "activate". Is there something else I should be doing? When I go back to normal view the formula is sometimes written out as it is rather than being "invisible".

Forgive my terminology... I'm still learning to speak code.

I'm still struggling the get numbers from a dropdown condition to multiply with a FORMTEXT field number. I've tried various ways explained in the tutorial. Again, I'm sure I'm either doing it wrong or assuming one thing works with another when it doesn't.
Reply With Quote
  #6  
Old 11-29-2016, 06:31 PM
Father Father is offline Expanding tables with calculating form fields? Windows 7 32bit Expanding tables with calculating form fields? Office 2013
Novice
Expanding tables with calculating form fields?
 
Join Date: Nov 2016
Posts: 29
Father is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
The 001 is simply the displayed output. You don't reference that in a calculation;
Is there a way to use the displayed output in a separate calculation? That's what I've been trying to do.

I tried using the table cell address that contains the output, but I'm guessing that's not an option either.
Reply With Quote
Reply

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
Expanding tables with calculating form fields? 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

Other Forums: Access Forums

All times are GMT -7. The time now is 07:09 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft