Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2020, 05:46 PM
sconeill92 sconeill92 is offline Needing to learn dependent drop downs and how to still keep the document editable Windows 7 64bit Needing to learn dependent drop downs and how to still keep the document editable Office 2016
Novice
Needing to learn dependent drop downs and how to still keep the document editable
 
Join Date: Feb 2020
Posts: 6
sconeill92 is on a distinguished road
Post Needing to learn dependent drop downs and how to still keep the document editable

Hi everyone!



So I'm new to learning how to do dependent drop downs in word and I've read a lot of different articles and threads on here, but I can't quite find the info I need.

I have a medical form in Word that my company has to fill out every time there is an incident. This form includes patient info, doctor info, drug info, and then a short description of what happened. The patient and doctor sections can be just copy-paste and the drug section is where I need the help.

I need a drop down for Drug name, strength, dosage, and route (orally, subcutaneous, etc). When I select one drug name, I need the strength, dosage, and route lists to auto-update to match that drug. I know I can use the legacy drop down lists but to make those work, I have to lock the form from editing which means that people can't free hand where needed so I think I need to use combo box or drop down list content controls.

Is there anyone that can help me with this please?
Reply With Quote
  #2  
Old 02-18-2020, 09:33 PM
gmayor's Avatar
gmayor gmayor is offline Needing to learn dependent drop downs and how to still keep the document editable Windows 10 Needing to learn dependent drop downs and how to still keep the document editable Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

My friend Greg Maxey has done much work on this. I'll post him a link to this thread in case he has missed it.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 02-18-2020, 10:46 PM
gmaxey gmaxey is offline Needing to learn dependent drop downs and how to still keep the document editable Windows 10 Needing to learn dependent drop downs and how to still keep the document editable Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,422
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

There are several ways to do that ranging from simply using the CC on exit event to mapping and monitoring the mapping update events.

Link "Conditional Content" to a List Selection
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #4  
Old 02-18-2020, 10:48 PM
macropod's Avatar
macropod macropod is offline Needing to learn dependent drop downs and how to still keep the document editable Windows 7 64bit Needing to learn dependent drop downs and how to still keep the document editable Office 2010 32bit
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 also:
Dependent Dropdown Content Controls
Help with cascading dropdown list

Hierarchical Dropdown Content Controls
Creating a reducing drop down list

Dependent Text Content Controls
Multiple entries in dropdown lists
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 02-19-2020, 12:27 PM
sconeill92 sconeill92 is offline Needing to learn dependent drop downs and how to still keep the document editable Windows 7 64bit Needing to learn dependent drop downs and how to still keep the document editable Office 2016
Novice
Needing to learn dependent drop downs and how to still keep the document editable
 
Join Date: Feb 2020
Posts: 6
sconeill92 is on a distinguished road
Default

Macropod thank you so much! I was able to copy-paste your VBA code from Dependent dropdown CC and just by changing the labels, it worked perfectly!

2 quick questions:

1. In this form I'm updating, I still want the next 2 fields to update but these are much simpler. I want something to the effect of "IF 'Eliquis', THEN '1 by mouth twice a day'' IF 'Orencia', THEN....." How do I do that or add that into the code?

2. Where can I go online to learn more about VBA and how to develop it myself?
Reply With Quote
  #6  
Old 02-19-2020, 02:40 PM
macropod's Avatar
macropod macropod is offline Needing to learn dependent drop downs and how to still keep the document editable Windows 7 64bit Needing to learn dependent drop downs and how to still keep the document editable Office 2010 32bit
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 sconeill92 View Post
1. In this form I'm updating, I still want the next 2 fields to update but these are much simpler. I want something to the effect of "IF 'Eliquis', THEN '1 by mouth twice a day'' IF 'Orencia', THEN....." How do I do that or add that into the code?
That suggest you need to incorporate the principles from the 'dependent text' example I provided a link for.
Quote:
Originally Posted by sconeill92 View Post
2. Where can I go online to learn more about VBA and how to develop it myself?
There are many such resources, including code samples on forums such as this. The quality is variable; avoid anything that uses lots of 'Selection', 'ActiveWindow.ActivePane.View.SeekView' and 'ChangeFileOpenDirectory' code, as that usually evidences heavy reliance on the macro recorder.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 02-20-2020, 12:39 PM
sconeill92 sconeill92 is offline Needing to learn dependent drop downs and how to still keep the document editable Windows 7 64bit Needing to learn dependent drop downs and how to still keep the document editable Office 2016
Novice
Needing to learn dependent drop downs and how to still keep the document editable
 
Join Date: Feb 2020
Posts: 6
sconeill92 is on a distinguished road
Default

Hey Macropod!

Thank you again for all your help! I have one final question for you though if you don't mind!

Here is a copy-paste of the section I've been working on:

Product Information:
Drug: Sprycel
Strength: Choose an item.
Dose: { IF { REF Drug \* MERGEFORMAT } = "Eliquis""1 by mouth twice a day""{ IF {REF Drug \* MERGEFORMAT } = "Orencia""Inject once under the skin once a week"" { IF {REF Drug \* MERGEFORMAT } = "Sprycel""1 by mouth once a day"}""}"" }
Route: {IF {REF Drug \* MERGEFORMAT } = "Eliquis""Orally""{ IF {REF Drug \* MERGEFORMAT } ="Orencia""Subcutaneous""{IF {REF Drug \* MERGEFORMAT } ="Sprycel""Orally"}""}"" }

When I hit alt-F9 both the dose and route disappear and just say "REF". If I select a drug, nothing happens in these fields. Can you advise why? The drug and strength fields are content control that you helped me with previously.

Thank you
Reply With Quote
  #8  
Old 02-20-2020, 02:56 PM
macropod's Avatar
macropod macropod is offline Needing to learn dependent drop downs and how to still keep the document editable Windows 7 64bit Needing to learn dependent drop downs and how to still keep the document editable Office 2010 32bit
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

Firstly, there is no need to use field coding for this - the VBA code in:
Dependent Text Content Controls
Multiple entries in dropdown lists
shows how to make those updates directly from the relevant content control.

Second, your use of fields means you'd have to add additional code to the ContentControlOnExit macro to get them to update.

Third, even if field coding were used, you don't need the \* MERGEFORMAT switches.

Fourth, in a document accessible for editing, there's a very real risk of someone overtyping/deleting the field coding; a content control, by comparison, can be protected against both.

Finally, as you why you're getting that particular error, that may be because you've typed some of the braces instead of creating them via Ctrl-F9 or via Insert|Cross-reference. There should also be a space between your "" sets.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 02-20-2020, 04:48 PM
sconeill92 sconeill92 is offline Needing to learn dependent drop downs and how to still keep the document editable Windows 7 64bit Needing to learn dependent drop downs and how to still keep the document editable Office 2016
Novice
Needing to learn dependent drop downs and how to still keep the document editable
 
Join Date: Feb 2020
Posts: 6
sconeill92 is on a distinguished road
Default

Ok so I didn't initially use the dependent CC because I have no clue where to add that into the VBA. Making it work for "drug" and "strength" was easy because all I had to do was change the labels in your example.

But how do I make room for 2 more fields? I'm so lost on what to do :/
Reply With Quote
  #10  
Old 02-20-2020, 05:38 PM
macropod's Avatar
macropod macropod is offline Needing to learn dependent drop downs and how to still keep the document editable Windows 7 64bit Needing to learn dependent drop downs and how to still keep the document editable Office 2010 32bit
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

This would be a lot easier to resolve if you attached your document to a post (delete anything sensitive). 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
  #11  
Old 02-20-2020, 05:52 PM
sconeill92 sconeill92 is offline Needing to learn dependent drop downs and how to still keep the document editable Windows 7 64bit Needing to learn dependent drop downs and how to still keep the document editable Office 2016
Novice
Needing to learn dependent drop downs and how to still keep the document editable
 
Join Date: Feb 2020
Posts: 6
sconeill92 is on a distinguished road
Default

So sorry for all the confusion. I have attached the document in question. The section I'm working on is titled product details
Attached Files
File Type: docm PHI BMS AE - test.docm (31.2 KB, 8 views)
Reply With Quote
  #12  
Old 02-20-2020, 06:38 PM
macropod's Avatar
macropod macropod is offline Needing to learn dependent drop downs and how to still keep the document editable Windows 7 64bit Needing to learn dependent drop downs and how to still keep the document editable Office 2010 32bit
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

Now that I've seen the document, it's even simpler than I thought. See attached.

Note: if you save the document as a Word macro-enabled template (i.e. a dotm file), then distribute that:
1. There'll be little risk of users messing things up by overwriting it; and
2. The resulting documents created from it can be saved as docx files.
Attached Files
File Type: docm PHI BMS AE.docm (39.0 KB, 12 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #13  
Old 02-21-2020, 10:16 AM
sconeill92 sconeill92 is offline Needing to learn dependent drop downs and how to still keep the document editable Windows 7 64bit Needing to learn dependent drop downs and how to still keep the document editable Office 2016
Novice
Needing to learn dependent drop downs and how to still keep the document editable
 
Join Date: Feb 2020
Posts: 6
sconeill92 is on a distinguished road
Default

Thank you so much! You're a godsend!
Reply With Quote
Reply

Tags
content control, dependent dropdown list, vba

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Needing to learn dependent drop downs and how to still keep the document editable Help with Colour Coding drop downs. Instructionalhelp Word VBA 11 03-15-2018 10:35 PM
Needing to learn dependent drop downs and how to still keep the document editable Lock specific drop downs on a Word Document icarrus Word 1 09-30-2015 02:07 PM
Drop Downs Suray1911 Excel 1 09-29-2015 10:31 PM
Needing to learn dependent drop downs and how to still keep the document editable field shading for drop downs rbd50 Mail Merge 3 03-31-2015 09:52 PM
Needing to learn dependent drop downs and how to still keep the document editable Drop-Downs: Run Macro on Exit Andrew H Word VBA 15 11-16-2012 08:34 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:40 PM.


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