Change View of Subform

  • Thread starter Thread starter Kristen
  • Start date Start date
K

Kristen

Hello,
I want to create a button that will allow the user to
change the view of a subform from single form to datasheet
view. Do you know the macro to create this?

Thank you!
 
Kristen said:
Hello,
I want to create a button that will allow the user to
change the view of a subform from single form to datasheet
view. Do you know the macro to create this?

Thank you!

This code, in a button on the main form, will toggle the subform named
"SubformControlName" between form view and datasheet view:

Private Sub cmdSwitchView_Click()

Me.SubformControlName.SetFocus
Application.RunCommand acCmdSubformDatasheet

End Sub

Note that "SubformControlName" must be the name of the subform *control*
on the main form, which isn't necessarily the same as the name of the
form object it displays.
 
Back
Top