Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-12-2021, 10:12 AM
shaun0406 shaun0406 is offline AutoFill Information Windows 10 AutoFill Information Office 2010
Novice
AutoFill Information
 
Join Date: Dec 2020
Posts: 19
shaun0406 is on a distinguished road
Smile AutoFill Information

Hello, I am a beginner in this field.
I am trying to do an autofill for some information in the form I am creating
I am using Legacy Forms to create my forms



Within the form, I have a drop down list bookmark: Company, with the items X and Y as choices. On the field settings, Calculate on exit is selected

In another line or section of the document, I have inserted a field to auto input Phone numbers

My field code is
{IF { Company }="X" "(111)111-1111" {IF {Company}="Y" "(234)567-8910"}}}

After protecting the document, for example, selecting "X" from the drop down list doesn't update the field code I wrote for autofill phone numbers when a Company drop down list have been selected

Please give help or give me suggestions as what I am doing wrong.
Thank You
Reply With Quote
  #2  
Old 04-12-2021, 12:25 PM
shaun0406 shaun0406 is offline AutoFill Information Windows 10 AutoFill Information Office 2010
Novice
AutoFill Information
 
Join Date: Dec 2020
Posts: 19
shaun0406 is on a distinguished road
Default

Update: My code works when I update the field with F9 in when unprotected, but I want it to fill in when someone selects an option from the Company drop down and updates the field
Reply With Quote
  #3  
Old 04-12-2021, 12:29 PM
Charles Kenyon Charles Kenyon is offline AutoFill Information Windows 10 AutoFill Information Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Change the properties of your company drop-down to "Calculate on exit."
Re-protect your document.
That should have the same effect as the F9 key.
Reply With Quote
  #4  
Old 04-12-2021, 12:39 PM
shaun0406 shaun0406 is offline AutoFill Information Windows 10 AutoFill Information Office 2010
Novice
AutoFill Information
 
Join Date: Dec 2020
Posts: 19
shaun0406 is on a distinguished road
Default

Quote:
Originally Posted by Charles Kenyon View Post
Change the properties of your company drop-down to "Calculate on exit."
Re-protect your document.
That should have the same effect as the F9 key.
I have the Dropdown (Bookmark: Company) set as calculate at exit. After protecting the document, it is not updating.


Note: I upload my document if you want to take a look at it. I have used content control and legacy field, but I plan to switch everything to legacy form when I can get the field codes to update.

Thanks!
Attached Files
File Type: docx Form_Experiment.docx (150.0 KB, 8 views)
Reply With Quote
  #5  
Old 04-12-2021, 12:55 PM
Charles Kenyon Charles Kenyon is offline AutoFill Information Windows 10 AutoFill Information Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

  • Your document has both Content Controls and legacy formfields. This is not a good mix. Make your Company dropdown a Content Control.
  • Do not use filling in forms protection.
  • This should be a document template, not a document.
  • The header should use a CREATEDATE field, not a Date Field. Using Date Fields in Microsoft Word
This utility has conversion from legacy fields to Content Controls. Each company control should have a different name. You can use a change event handler to insert the information you need in other content controls. So, you would have:
  • Company1, Phone1, Specialty1, and Address1
  • Company2, Phone2, Specialty2, and Address2
etc. Content Controls. The event handler macro would fill in the rest of the line based on changes in the Company dropdowns.
Reply With Quote
  #6  
Old 04-12-2021, 01:15 PM
shaun0406 shaun0406 is offline AutoFill Information Windows 10 AutoFill Information Office 2010
Novice
AutoFill Information
 
Join Date: Dec 2020
Posts: 19
shaun0406 is on a distinguished road
Default

Thanks for the suggestion!

I am currently using a dotx, but I will be saving it as a template once I am done with everything.

So for the event handler, I need to code it in VBA to fill the rest of the information?

I am have little knowledge on VBA but I will look this up and improve

Thanks!
Reply With Quote
  #7  
Old 04-12-2021, 02:01 PM
Charles Kenyon Charles Kenyon is offline AutoFill Information Windows 10 AutoFill Information Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

.dotx is a template. You will want to change to .dotm.

Yes, you will need an event handler. I cannot supply that right now. Someone else will likely help you with this. There have been a number of questions and answers on this in the VBA Forum. Search for dropdown.
Reply With Quote
  #8  
Old 04-12-2021, 02:03 PM
shaun0406 shaun0406 is offline AutoFill Information Windows 10 AutoFill Information Office 2010
Novice
AutoFill Information
 
Join Date: Dec 2020
Posts: 19
shaun0406 is on a distinguished road
Default

Great, Thank You
Reply With Quote
  #9  
Old 04-12-2021, 02:26 PM
shaun0406 shaun0406 is offline AutoFill Information Windows 10 AutoFill Information Office 2010
Novice
AutoFill Information
 
Join Date: Dec 2020
Posts: 19
shaun0406 is on a distinguished road
Post Macro For ComboBox selection to autofill another Content Control

Hello, I am have very little knowledge in VBA.

I am creating a form for the company I am working for.
I am using a content control user forms

I have a combo box (Title/Tag : Doctor)

After selecting a choice, I want a text content control (Phone) to autofill the information

Someone have suggested using a change Event Handler, but I do not know how to do this. If someone can help me with this I appreciate it

Thank You
Reply With Quote
  #10  
Old 04-12-2021, 02:26 PM
Charles Kenyon Charles Kenyon is offline AutoFill Information Windows 10 AutoFill Information Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Take a look at this thread.
https://www.msofficeforums.com/word-...dent-drop.html
and this thread
https://www.msofficeforums.com/word-...down-text.html
Reply With Quote
  #11  
Old 04-12-2021, 02:52 PM
macropod's Avatar
macropod macropod is offline AutoFill Information Windows 10 AutoFill Information Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

See:
https://www.msofficeforums.com/word-...html#post46903
and, for different elements from a selected item to be output to different content controls, see:
https://www.msofficeforums.com/word-...tml#post120392
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #12  
Old 04-12-2021, 02:58 PM
macropod's Avatar
macropod macropod is offline AutoFill Information Windows 10 AutoFill Information Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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 shaun0406 View Post
My field code is
{IF { Company }="X" "(111)111-1111" {IF {Company}="Y" "(234)567-8910"}}}

After protecting the document, for example, selecting "X" from the drop down list doesn't update the field code I wrote for autofill phone numbers when a Company drop down list have been selected

Please give help or give me suggestions as what I am doing wrong.
The problem is the way you're referencing the dropdown, plus the lack of required spaces in the field code. Instead of:
Code:
{IF { Company }="X" "(111)111-1111" {IF {Company}="Y" "(234)567-8910"}}}
use:
Code:
{IF{REF Company}= "X" "(111)111-1111"}{IF{REF Company}= "Y" "(234)567-8910"}
As Charles said, though, you really shouldn't use formfields and content controls in the same document; they don't play well together.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #13  
Old 04-12-2021, 03:24 PM
Charles Kenyon Charles Kenyon is offline AutoFill Information Windows 10 AutoFill Information Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Looking at your document, for some reason I was unable to apply any editing restriction (including filling in forms) to it.
Reply With Quote
  #14  
Old 04-12-2021, 03:51 PM
macropod's Avatar
macropod macropod is offline AutoFill Information Windows 10 AutoFill Information Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Since you output all goes in the same table, try the attached, which based on the code in the link I pointed you to above (I have merged your threads).
Attached Files
File Type: docm Form_Experiment.docm (45.2 KB, 10 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #15  
Old 04-14-2021, 07:32 AM
shaun0406 shaun0406 is offline AutoFill Information Windows 10 AutoFill Information Office 2010
Novice
AutoFill Information
 
Join Date: Dec 2020
Posts: 19
shaun0406 is on a distinguished road
Default

This works perfectly, Thank You
Reply With Quote
Reply

Tags
auto fill, auto generate, autofill, content controls, fields word functions, word vba

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
AutoFill Information Question about autofill oscarlimerick Excel 3 01-15-2021 04:12 AM
Combo Box and AutoFill samrosen Word VBA 5 08-03-2016 05:12 AM
Creating AutoFill form - AutoFill information depending on a selection. RyanHarper Word 3 06-15-2015 01:01 PM
Autofill Stacybug1 Excel 2 01-28-2015 01:04 PM
AutoCorrect Or AutoFill Johnny thunder Outlook 0 05-02-2011 03:37 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:15 AM.


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