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

DoCmd.OpenTable Method (Access)

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

The OpenTable method carries out the OpenTable action in Visual Basic.


expression. OpenTable( ** TableName, ** View, ** DataMode** )

expression A variable that represents a DoCmd object.


NameRequired/OptionalData TypeDescription
TableNameRequiredVariantA string expression that's the valid name of a table in the current database. If you execute Visual Basic code containing the OpenTable method in a library database, Microsoft Access looks for the table with this name first in the library database, then in the current database.
ViewOptionalAcViewA AcView constant that specifies the view in which the table will open. The default value is acViewNormal.
DataModeOptionalAcOpenDataModeA AcOpenDataMode constant that specifies the data entry mode for the table. The default value is acEdit.


You can use the OpenTable method to open a table in Datasheet view, Design view, or Print Preview. You can also select a data entry mode for the table.


The following example opens the Employees table in Print Preview:

DoCmd.OpenTable "Employees", acViewPreview

See also


DoCmd Object

© 2018 Microsoft