Summary


In this hour , you just scratched the surface of Word's forms. If you are not interested in writing VBA macros, you will probably never delve any deeper into this feature. However, if you know VBA or are planning on studying it, you might want to keep poking around the forms feature to learn more. Furthermore, knowing a little about what advanced forms can do for you will also be helpful if you work with programmers in the future. Here are just a few of the possibilities:

  • You can create forms that populate fields with information retrieved from a database or store user input into a database.

  • You can validate input data to make sure it has been entered correctly and corresponds to data in your database.

  • You can create forms that have a far broader range of input controls, including option buttons , list boxes, and so on.

  • You can also use forms to create interactive documents. For example, you might create a vacation request form that contains a calendar showing dates that would conflict with vacations already approved for other coworkers.

To create forms with more sophisticated user interfaces and/or forms that communicate with databases and execute VBA code, you will need to use some combination of entry and exit macros and ActiveX controls.

Entry and Exit Macros

An advantage of using entry and exit macros is that the macros run code that interacts with the standard Word form fields (as opposed to fields created with ActiveX controls). Word's text form fields can blend right into the text stream, so you can create documents that don't look like forms at all but execute code in the background. Entry macros are used to set default content in form fields, and are especially handy when the defaults are contingent on one or more other fields. So, for example, you could use an entry macro in a bed-and- breakfast reservation form to set the default departure date for one day after the arrival date. Exit macros are commonly used to validate data and may also be used to update other fields. In many cases, you can perform the same tasks using entry or exit macros ”there are pros and cons to each method, and the one you choose is a judgment call.

ActiveX Controls

Microsoft developed ActiveX controls to provide tools you can use in all of the Office applications to design user interfaces, including forms and dialog boxes, and attach VBA code to them. ActiveX controls are much more extensive than Word's form fields. They include option buttons, list boxes, spinner arrows, and so on. (To see what controls are available, choose View, Toolbars, Control Toolbox. The Control Toolbox toolbar is designed for working with ActiveX controls.) Unlike Word's text form fields, ActiveX controls are not designed to be able to blend into the text stream; they look like the user-interface elements that they are, both onscreen and when printed.



Sams Teach Yourself Microsoft Office Word 2003 in 24 Hours
Sams Teach Yourself Microsoft Office Word 2003 in 24 Hours
ISBN: 067232556X
EAN: 2147483647
Year: 2003
Pages: 315
Authors: Heidi Steele

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net