DoCmd.OpenTable (Access)
The OpenTable method carries out the OpenTable action in Visual Basic.
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.
OpenTable (TableName, View, DataMode)
DoCmd.OpenTable "Employees", acViewPreview
Arguments
The following argument is required
TableName (String) - A 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, and then in the current database.
Optional arguments
The following arguments are optional
View (AcView) - An AcView constant that specifies the view in which the table will open. The default value is acViewNormal.
Possible values are
acViewDesign | Design view |
acViewLayout | Layout view |
acViewNormal | Normal view |
acViewPivotChart | PivotChart view |
acViewPivotTable | PivotTable view |
acViewPreview | Print Preview |
acViewReport | Report view |
DataMode (AcOpenDataMode) - An AcOpenDataMode constant that specifies the data entry mode for the table. The default value is acEdit.
Possible return values are acAdd - The user can add new records but can't view or edit existing records, acEdit - The user can view or edit existing records and add new records, acReadOnly - The user can only view records.