Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PivotChart View (2003)

    I have a form with the default view setting up to PivotChart. When I open the form from the database windows it works as expected: the form is opened in PivotChart view. Then I have added a Access Switchboard with one button to open this form in edit mode, unfortunately the form is opened in form view and not in PivotChart view. Do I have a way to add some code in the Open Event to force the PivotChart view to pop up.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: PivotChart View (2003)

    Pivot charts were introduced into Access long after the Switchboard. The code behind the Switchboard form "as is" does not support opening a form as pivot chart. It is not difficult to modify it, but you will lose the ability to modify the item in the Switchboard Manager. (Adding code to the On Open, On Load or On Activate event of the form to be opened doesn't seem to work.)

    Open the Switchboard form in design view, and activate the Visual Basic Editor (Alt+F11)
    Locate the HandleButtonClick function.
    Add a line to the list of constants the function recognizes:

    <code>[tabConst conCmdOpenFormPivotChart = 10</code>

    And add these lines to the <code>Select Case rs![Command]</code> block, above <code>Case Else</code>:

    <code> ' Open a pivot chart form</code>
    <code> Case conCmdOpenFormPivotChart</code>
    <code> DoCmd.OpenForm rs![Argument], acFormPivotChart</code>

    Close and save the Switchboard form.
    Open the Switchboard Items table.
    Locate the record associated with the pivot chart form. The Command field will have value 3, and the Argument field will contain the name of the form. Change the value of Command from 3 (=conCmdOpenFormBrowse) to 10 (=conCmdOpenFormPivotChart).

    That's it! If you want to view other forms as pivot charts, use the Switchboard Manager to add a menu item, with action "Open form in edit/browse mode". Then edit the table to change the Command argument from 3 to 10, as above.

    You can add other non-standard actions this way, if you like.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: PivotChart View (2003)

    An alternative is to use the standard Run Code command:
    - Create a function in a standard module:

    Public Function OpenPivotChart()
    DoCmd.OpenForm "frmMyPivotChart", acFormPivotChart
    End Function

    - In the Switchboard Manager, select Run Code as command, and OpenPivotChart as Function.

  4. #4
    2 Star Lounger
    Join Date
    Feb 2001
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PivotChart View (2003)

    Hans,

    Thank very much, it works perfectly,

    Best regards,

    Marcel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •