Form.AllowDatasheetView Property (Access)

Returns or sets a Boolean indicating whether the specified form may be viewed in Datasheet View. True if Datasheet View is allowed. Read/write.

expression .AllowDatasheetView

expression A variable that represents a Form object.

Use the AllowDatasheetView, AllowFormView, AllowPivotChartView, or AllowPivotTableView properties to control which views are allowed for a form.

The following example makes Datasheet View valid for the specified form and then opens the form in Datasheet View.

Forms(0).AllowDatasheetView = True 
DoCmd.OpenForm FormName:=Forms(0).Name, View:=acFormDS