ViewsAllowed Property [Access 2003 VBA Language Reference]
You can use the ViewsAllowed property to specify whether users can switch between Datasheet view and Form view by clicking the Form View or Datasheet View command on the View menu or by clicking the arrow next to the View button and clicking Form View or Datasheet View. Read/write Byte.
expression Required. An expression that returns one of the objects in the Applies To list.
The ViewsAllowed property uses the following settings.
|Both||0||(Default) Users can switch between Form view and Datasheet view.|
|Form||1||Users can't switch to Datasheet view from Form view.|
|Datasheet||2||Users can't switch to Form view from Datasheet view.|
Note Design view is always available (unless permissions are set otherwise).
The views displayed in the View button list and on the View menu depend on the setting of the ViewsAllowed property. For example, if the ViewsAllowed property is set to Datasheet, Form View is disabled in the View button list and on the View menu.
The combination of these properties creates the following conditions.
|Single, Continuous Forms, or Datasheet||Both||Users can switch between Form view and Datasheet view.|
|Single or Continuous Forms||Form||Users can't switch from Form view to Datasheet view.|
|Single or Continuous Forms||Datasheet||Users can switch from Form view to Datasheet view but not back again.|
|Datasheet||Form||Users can switch from Datasheet view to Form view but not back again.|
|Datasheet||Datasheet||Users can't switch from Datasheet view to Form view.|
The following example prints a message in the Immediate window indicating the state of how users can switch between Datasheet view and Form view for the "Switchboard" form.
Debug.Print "ViewsAllowed = " & Forms.Item("Switchboard").ViewsAllowed
Applies to | Form Object