Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

Form.SubdatasheetExpanded Property (Access)

You can use the SubdatasheetExpanded property to specify or determine the saved state of all subdatasheets within a table or query. Read/write Boolean.

expression .SubdatasheetExpanded

expression A variable that represents a Form object.

The default value is False.

To set the SubdatasheetExpanded property by using Visual Basic, you must first create the property by using the DAO CreateProperty method.

The SubdatasheetExpanded and SubdatasheetHeight properties take effect on the subform control when the form is in datasheet view.

The following example turns subdatasheet expansion on or off for the "Purchase Orders" form.

To try this example yourself, open a form (containing a subform) in Design view, click the Builder button next to the On Load property box in the form's property window, paste this code into the form's Form_Load event (removing the reference to the "Purchase Orders" form), and then open the form in Datasheet view.

Dim strExpand As String 
 
With Forms("Purchase Orders") 
 
 strExpand = InputBox("Expand subdatasheets? Y/N") 
 
 Select Case strExpand 
 Case "Y" 
 .SubdatasheetExpanded = True 
 Case "N" 
 .SubdatasheetExpanded = False 
 Case Else 
 MsgBox "Can't determine subdatasheet expansion state." 
 End Select 
 
End With
Show:
© 2015 Microsoft