Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 462
  • Last Modified:

Switch nested sub to either datasheet, pivotTable or pivotChart view in Access 2007

Hello all,
I have a main form (aka Form3) with a sub form (aka Form2) in it and another sub form (aka Form1) in that.  From the main form (aka Form3) I want to have the user be able to click a button in an option group and have it switch the view of the nested sub form (aka Form1) to the option they selected.

I tried using something like this:

    DoCmd.RunCommand acCmdDatasheetView

but it seems to change the main forms view to datasheet rather than the nested sub.  I've tried other variations, but only end up getting an error saying something about the command not being available at this time.

Any ideas?
  • 2
1 Solution
Cristal638Author Commented:
Maybe I should make this a little clearer:  Here's a question that was posted on another site by a user back in 2002.  Unfortunately nobody responded with the answer.  Hopefully this won't be the case here.  Anyway here's what the user wrote:

Does anyone know how to toggle a nested subform's view
from datasheet and form. Using a combination of set focus
and the "DoCmd.RunCommand acCmdSubformDatasheet" command
always changes the first level subform.
Cristal638Author Commented:
I figured it out...


    Select Case Me.TabCtl7
    Case 0  'PivotTable View
        Access.RunCommand acCmdSubformPivotTableView
    Case 1  'DataSheet View
        Access.RunCommand acCmdSubformDatasheetView
    Case 2  'PivotChart View
        Access.RunCommand acCmdSubformPivotChartView
    End Select

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now