The information in this article applies to:
SUMMARY
Advanced: Requires expert coding, interoperability, and multiuser skills.
MORE INFORMATION
The CreateControl() and CreateReportControl() functions require two
arguments: the name of the form or report as a string value, and a numeric
code that represents the control type.
NOTE: In Microsoft Access 1.x, use MyForm.FormName instead of MyForm.Name).
When the procedure is finished, you can modify the properties of the new control by using the control variable that you defined. For example, you can change the control's Width and Caption properties with these statements:
For controls that are frequently associated with a field in a table or
query, you can modify the ControlSource property to bind the control to
the field.
By default, some controls are created with their Height and Width properties set to zero to make them invisible. Also by default, controls appear in the upper-left corner of the form. You can adjust the size and position of a control immediately after you create it by changing the control's properties. For example, the following code creates, sizes, and moves a text box by changing the properties: In Microsoft Access 7.0 and 97:
In Microsoft Access 1.x and 2.0:
In addition to the form name and the code for the type of control, you can
also specify the form or report section where you want Microsoft Access to
place the control.
REFERENCESFor more information about creating a control in code, search the Help Index for CreateControl or CreateReportControl or ask the Microsoft Access 97 Office Assistant. Additional query words:
Keywords : kbprg FmrProp PgmObj |
Last Reviewed: November 10, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |