Table of contents
Collapse the table of content
Expand the table of content

Application.DeleteReportControl Method (Access)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

The DeleteReportControl method deletes a specified control from a report.


expression. DeleteReportControl( ** ReportName, ** ControlName )

expression A variable that represents an Application object.


NameRequired/OptionalData TypeDescription
ReportNameRequiredStringThe name of the report containing the control you want to delete.
ControlNameRequiredStringThe name of the control you want to delete.

Return Value



The DeleteReportControl 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.


The following example creates a form with a command button and displays a message that asks if the user wants to delete the command button. If the user clicks Yes, the command button is deleted.

Sub DeleteCommandButton() 
 Dim frm As Form, ctlNew As Control 
 Dim strMsg As String, intResponse As Integer, _ 
 intDialog As Integer 

 ' Create new form and get pointer to it. 
 Set frm = CreateForm 
 ' Create new command button. 
 Set ctlNew = CreateControl(frm.Name, acCommandButton) 
 ' Restore form. 
 ' Set caption. 
 ctlNew.Caption = "New Command Button" 
 ' Size control. 
 ' Prompt user to delete control. 
 strMsg = "About to delete " &; ctlNew.Name &;". Continue?" 
 ' Define buttons to be displayed in dialog box. 
 intDialog = vbYesNo + vbCritical + vbDefaultButton2 
 intResponse = MsgBox(strMsg, intDialog) 
 If intResponse = vbYes Then 
 ' Delete control. 
 DeleteControl frm.Name, ctlNew.Name 
 End If 
End Sub

See also


Application Object

© 2018 Microsoft