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

Posted on 2008-11-17
Last Modified: 2013-11-28
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?
Question by:Cristal638
    LVL 2

    Author Comment

    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.
    LVL 2

    Accepted Solution

    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

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    In the previous article, Using a Critera Form to Filter Records (, the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now