DoCmd.OpenTable (TableName, View, DataMode,)
- TableName: It is the name of a table in the current database. It is a required argument. It must be written between double quotes.
- View: There are a few types of form's view such as acViewDesign, acViewNormal, acViewPreview, and so on. You can choose one among those view types.
- DataMode: This argument allows you to specify the data entry mode for your table. You can add data, edit data, or you can only read the data.Remark: All arguments in DoCmd.OpenTable syntax are optional except TableName argument.
For example, you want to open a table in Datasheet View with add new data mode when you click Open Table button on the Form1. To do this task, you must apply the VBA code in CmdOpenTable_Click event procedure as the following:
Private Sub CmdOpenTable_Click()
DoCmd.OpenTable "TblBook", acViewNormal, acAdd
Note: The name of Command Button is optional.
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages: