Ask the Exchange Pro 10-Minute Solution

Creating Custom Forms
By Ben M. Schorr

One of the most important tasks in creating custom Outlook and Exchange applications is creating the custom forms that will provide the user interface to the application.

You can't create a new Outlook form from scratch. All Outlook forms are based upon one of the base Outlook forms, such as Message, Contact, Appointment, Task, Journal, and so forth. To create a new form you should first consider which of those base forms most closely approximates what you hope to end up with, and start from there.

To open the Outlook Forms Designer, start Outlook and then click Tools | Forms | Design a Form. Select the base form you wish to start with; it will open in the Forms Designer. One thing you'll notice is that you can't modify every page on every form—for instance you can't modify the first page of the Appointment form or the attendee availability page either. You can modify the first page on the Contacts form, but not any of the other pre-created pages, such as Details or Certificates. You'll need to do your modifications to the extra pages in those forms.

Laying Out Your Text
The Outlook Forms Designer has a lot of tools to help you lay out your custom forms exactly the way you like them.

The first tool is the basic dot grid, which it uses to overlay your form. Your controls on the form will, by default, snap to the nearest grid dot—helping to ensure that they line up consistently. You can adjust the size of the grid (i.e., the spacing between the dots) by going to Form | Set Grid Size in the Forms Designer. If you don't want the controls to snap to a grid dot, select Layout | Snap to Grid to disable that feature. You can also turn the grid off entirely in the Layout Menu by clicking the "Show Grid" menu item.

To match up two controls on the form you can eyeball it and hope for the best, or make use of some of the layout tools. Select the first control, then hold down the Ctrl key and select the rest. One of the controls will have white handles and the rest will have black—the one with the white handles is the "master control" that to which the other ones conform. Now click Layout | Align to force the selected controls to line up with each other on the top, bottom, center, or left or right edges; or click Layout | Make Same Size to set the controls to be the same height, width, or both.

Creating Multiple Pages
Outlook forms can have multiple pages. When you open a form in the Forms Designer you will see several tabs appear with names like "(p.2)," "(p.3)," and so forth. A page whose name is in parentheses is a hidden page—the user won't see it. To unhide that page, select it and then click "Form | Display this Page." Most of those pages are going to be blank initially—you can add any controls you like to them, then unhide them to give your users more functionality.

In many cases, the default forms, like the Contact form, suits your purpose pretty well—and you'd like to have just a half dozen additional fields to choose from, perhaps some custom fields as well. Open the Contact form in the Forms Designer, select one of the hidden blank pages, add your new controls and custom fields to that page, unhide the page, then publish that form (you'll have to give it a new name), and use that to create new items in the Contacts folder.

Voilà! You've just added some functionality to the application for your users.

Adding Controls to Your Form
To add new controls to your form, use the Control Toolbox and the Field chooser. To launch the Control Toolbox, select Form | Control Toolbox. The Control Toolbox has 15 basic controls that you can add to an Outlook form.

Add a Label control to place text in your form. Add a TextBox control, which you can bind to an Outlook field, as a way to display, add, or edit the values of that field. You can add ComboBox or ListBox controls that allow your users to select from a predefined list of values for the field. ComboBoxes also allow a user to type in their own value if none of the predefined ones are appropriate; ListBoxes give you the security of forcing the user to select from a predefined value without the discretion to type in their own.

You can populate Combo or List boxes at design-time with specific values, or you can do it programmatically at run time so that when the user opens the form, the script will fill in the possible values from items in another folder—such as names from the Contacts folder, for example.

You can add a Command Button that will run Visual Basic Script code that you specify. To add the code for the button simply double-click it in the Forms Designer and the Code editor will open, ready to accept your code. Control buttons can also be bound to fields—a Control Button bound to the "TO" field, for example, will launch the address book in the familiar chooser mode that allows you to add names from the address books to the TO, CC, or BCC fields—just as you're used to seeing when you click the TO or CC button on a Compose Message form.

To use the Field Chooser click Form | Field Chooser. You can then select from among all of the Outlook fields appropriate for the form you're designing. Just drag and drop the chosen field to the form; or click the "New" button at the bottom left of the Field Chooser to create a new custom field.

A Frame Control groups your controls together both visually and functionally. If you're adding Option Button controls (a.k.a. Radio Buttons), enclose the group of option buttons within a Frame control—that will make the Option buttons mutually exclusive. By binding the Option buttons to the same field (on the Properties | Value tab) you can create radio buttons that let your users select one, and only one, value for that field.

Checkboxes and Toggle buttons are two ways to achieve the same effect. A checkbox lets you set the value of a yes/no, true/false field by checking (Yes/True) or unchecking (No/False) the box. A toggle button presents a 3D button on the screen, which can be pressed in (Yes/True) or unpressed (No/False).

Publishing Your Form
When you're done creating your custom forms you can publish them to your personal forms library, an organizational forms library, or to a specific folder (public or private). Publishing a form to a specific folder can be useful, but it limits its easy use to that folder only.

The Personal Forms Library is best used for forms that you're still developing and not ready to release, and for forms that you're going to use only personally. The Organizational Forms Library is hosted on the Exchange Server. Forms published there are available to all users with the appropriate permissions—generally that's everybody.

When you're ready to publish your form, choose Tools | Forms | Publish Form As, select where you want to publish the form, give it a name, and click "Publish."

 
Other 10-Minute Solutions
 Personalizing Your Journal Entries
 Reliable E-mail Auto-forwarding
 Fine-Tuning Your Exchange Server: Part I
 Fine-Tuning Your Exchange Server: Part II
 Fine-Tuning Your Exchange Server: Part III
 Don't Go Relayin'...
 Using Public Folders to Share E-Newsletters
 Exchange Disaster Recovery Basics: Part I
 Cleaning the Nasty Stuff Off Your Exchange Server
 Handling Automatic Attachments in Outlook
 One-Click Pony Express
 Creating Custom Forms
 Using Combination and Formula Fields in Outlook Applications
 Backup and Restore in Exchange 2000
 Pulling a Switcheroo on Contact Data
 Regain Control of Outlook by Configuring the Security Patch
 The Right Format for the Right Recipient


Ask the Exchange Pro | Who Is the Pro? | Usage Policies | Ask a Question | Search | Feedback


Sponsored Links


Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map
Jupiterweb networks

internet.comearthweb.comDevx.comClickZ

Search Jupiterweb:

Jupitermedia Corporation has four divisions:
JupiterWeb, JupiterResearch, JupiterEvents, and JupiterImages

Copyright 2004 Jupitermedia Corporation All Rights Reserved.
Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Jupitermedia Corporate Info | Newsletters | Tech Jobs | E-mail Offers