There are no special requirements for a subform. However, you must remember that the form is going to be used to display the many side of a one-to-many relationship, and that all forms are not suitable for this task.

Typically a subform is a tabular form, that is, a form with a table box. The table box should fill out the form completely. The HorzGlue and VertGlue properties of both the table box on the subform and the subform control on the main form should be set to Both. This ensures that the subform and the table box are resized when the main form is resized.

Formatting Subforms

Although creating a form with a subform is the same as creating controls on forms, you may have to experiment before you find the best way to do it.

Here are some hints and advice to help you accomplish this task:

  • It can be difficult to get the correct size of the subform control on the main form and the size of the subform. You should finish the design of the subform first. Get the values for the width and the height of the form from the Properties window of the subform. Then, in the main form, place a subform control of any size. In the Properties window, insert the width and height of the subform as the width and height of the subform control.

  • Generally, if the subform is a tabular form, it looks better if you let the table box completely fill out the form vertically. This ensures that there is no extra space around the table inside the subform control. Set the HorzGlue and VertGlue properties to Both.

  • If the subform is a tabular form, you should set the size of the form so that it only displays a few records at a time. Then, in the main form, set the VertGlue and HorzGlue properties of the subform control to Both. You can resize the main form vertically and horizontally. The subform is resized along with it so that either more or less records and fields are displayed.

See Also