DeleteControl Method

Microsoft Office Access 2003

expression.DeleteControl(FormName, ControlName)

expression    Required. An expression that returns one of the objects in the Applies To list.

FormName   Required String. A string expression identifying the name of the form or report containing the control you want to delete.

ControlName   Required String. A string expression identifying the name of the control you want to delete.

Remarks

For example, suppose you have a procedure that must be run the first time each user logs onto your database. You can set the OnClick property of a button on the form to this procedure. Once the user has logged on and run the procedure, you can use the DeleteControl method to dynamically remove the command button from the form.

The DeleteControl method is available only in form Design view or report Design view, respectively.

Note  If you are building a wizard that deletes a control from a form or report, your wizard must open the form or report in Design view before it can delete the control.