Microsoft KB Archive/216675

= ACC2000: How to Switch a Subform from Datasheet View to Form View =

Article ID: 216675

Article Last Modified on 6/29/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q216675



This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

Moderate: Requires basic macro, coding, and interoperability skills.



SUMMARY
This article shows you how to switch the view of a subform from Datasheet view to Form view while the main form is open in Form view.



MORE INFORMATION
 Open the sample database Northwind. Open the Orders form in Design view. Add a command button to the main form. If the Command Button Wizard appears, click Cancel.  Set the following properties for the command button:   Name: cmdChangeView Caption: Change View OnClick: [Event Procedure]   Set the OnClick property of the command button to the following event procedure: Private Sub cmdChangeView_Click Me![Orders Subform].SetFocus DoCmd.RunCommand acCmdSubformDatasheet End Sub  Close the Visual Basic Editor, and then open the Orders form in Form view.</li> Click the Change View button to switch the subform from Datasheet view to Form view. Note that the button toggles the subform view. In other words, each time that you click the button, the subform changes either from Datasheet view to Form view, or vice versa.</li></ol>

Additional query words: inf programmatically

Keywords: kbhowto KB216675

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.