Results 1 to 3 of 3
  1. #1
    Stepford is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Swindon, UK
    Posts
    7

    How do I get my form to open in pivot chart view?

    I have an information form in my database that gives a whole host of data on a user selected Product_ID and separately I have created a pivot chart form that gives the weekly shipments for a chosen Product_ID over 52 weeks.
    I added a control button my information form for the user to click so that they can see the weekly shipment data for their selected Product_ID if they want to, but unfortunately when I click on this button, it opens the pivot chart form in design view.
    Now I am guessing the issue down to the fact that there is something missing from my control button code, but I have to confess that code writing isn't my forte so I am not sure what I need to change / add to it to get my desired result.
    Here is my "On click" "Event Procedure" code below. Any assistance would be greatly appreciated
    Private Sub View_Chart_Click()
    On Error GoTo Err_Search_Click


    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "Weekly Shipments"
    stLinkCriteria = "[Product_ID]=" & "'" & Me![Product_ID] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Exit_Search_Click:
    Exit Sub


    Err_Search_Click:
    MsgBox Err.Description
    Resume Exit_Search_Click


    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Try:

    DoCmd.OpenForm stDocName, acFormPivotChart, , stLinkCriteria

    Can simplify your code:

    Code:
    Private Sub View_Chart_Click()
    On Error GoTo Err_Search_Click
    DoCmd.OpenForm "Weekly Shipments, acFormPivotChart , , "[Product_ID]='" & Me![Product_ID] & "'"
    
    Exit_Search_Click:
        Exit Sub
    
    Err_Search_Click:
        MsgBox Err.Description
        Resume Exit_Search_Click
    End Sub
    

    Is Product_ID a text type field?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Stepford is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Swindon, UK
    Posts
    7
    Ace!
    Many thanks June7! That did the trick nicely. I had a feeling it was going to be something really easy. Thank you so much!
    Oh and yes: Product_ID is a text type field

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 03-09-2014, 03:21 PM
  2. Replies: 4
    Last Post: 12-02-2011, 06:22 PM
  3. Replies: 0
    Last Post: 11-30-2011, 02:01 PM
  4. Replies: 2
    Last Post: 07-12-2010, 05:39 AM
  5. Design view not showing data (Pivot Chart)
    By thestappa in forum Reports
    Replies: 0
    Last Post: 06-24-2010, 09:59 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums