Word 2010 activation and deactivation of fields

Posted on 2011-10-17
Last Modified: 2012-05-12
I hope I can explain this one clearly.  Is it possible to have fields that will either become available or not available based on one field being populated? For example, I have a field for a date and if a date is entered into the field I need two other fields to become active and if no date is entered into the date field I need those fields to be unavailable. In other words, they could not be populated. The fields that would become active or not active are comment fields that will be used for additional information.  Is this possible?  Thank you.
Question by:SAW56
    LVL 76

    Expert Comment

    You could do that with 'legacy' form fields in a forms-protected document using VBA coding.
    LVL 100

    Expert Comment

    What tool are you trying to do this in?

    You have 3 zones that generally aren't related?
    Is this a MS Office/Word issue?
    A Crystal Reports issue? A Business Objects issue?


    Author Comment

    mlmcc - I'm not sure what happened but this was a new question and I only selected Microsoft Word and Microsoft Office. Do you think the browser or this site somehow stored information from the question I posted last week (that one had zones Crystal and Business Objects)?
    LVL 76

    Expert Comment

    We need to know if the Word form field, VBA solution could be acceptable, because there is likely to be a lot of detail necessary.

    Author Comment

    GrahamSkan: The VBA solution would be acceptable but could you give me some idea on how to do it? I am far from an expert with VBA so could you send me an example of how to set it up? Thanks.
    LVL 76

    Accepted Solution

    Use the Developer tab o the ribbon.

    You need to put 'Legacy' Text input form fields on the document.

    You also need to put an exit macro in a module in the document or in its template. You will probably be designing a template here, so the document will be saved as such. Therefore the code will go in the current document.
    There is some get-you-started advice on editing VBA code at the end of this article:

    After the code is written, right-click on the date field, select 'Properties and then browse for the macro in the Exit macro box. OK the 'Text Form Field Options' dialogue away. Finally, protect the document for Filling in forms.

    The exit macro will run when the text cursor leaves the date field.

    The uploaded example is in Word 97-2003 format because the 2007/2010 macro-enabled extension is not permitted here.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
    Outlook Free & Paid Tools
    The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
    This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now