Manipulate Database Objects Using DoCmd in Microsoft Access

Open Form

Private Sub SaleOrdersDesignViewButton_Click()
DoCmd.openForm "Sale Orders", acDesign, , , acFormPropertySettings
End Sub

Open Report

Private Sub printPreviewReport_Click()
DoCmd.OpenReport "Sale Orders", acViewPreview, , , acWindowNormal
End Sub

Open Table

Private Sub SaleOrdersDesignViewButton_Click()
DoCmd.openForm "Sale Orders", acDesign, , , acFormPropertySettings
End Sub

Open Query

Close Objects

to close an active object

DoCmd.Close DoCmd.Close acTable, “TableName”

Close Database

DoCmd.CloseDatabase

Quit Acces

DoCmd.Quit options

Run Access Menu Commands Using VBA

DoCmd.RunCommand(acCmdExportExcel)

DoCmd.PrintOut acPrintAll, , , acHigh, 1, True

Turn of warnings

DoCmd.SetWarnings False

Turn of warnings

DoCmd.SetWarnings True

Previous
Next