Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2008
    Posts
    189

    Question Unanswered: Change parameter of a Subform inside a Report

    Any ideas how to make this code works?

    Code:
        DoCmd.OpenReport "iTemp - PDF", acViewDesign
        Reports("Report1").Controls("Form1").SourceObject = "Form." & vNombreFormulario
        Reports("Report1").Controls("Form1").Parent.DefaultView = 4
    My problem is with the line Reports("Report1").Controls("Form1").Parent.DefaultView = 4

    What I want to do is to change the DefaultView of a Form to 4, which is "PivotChart".

    Also, this Form that I want to modify the property, is a "Subform" inside a Report called "Report1".

    Ideas?

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    You can't change this attribute outside of design view.
    Why would you want to do this through code anyway?
    George
    Home | Blog

  3. #3
    Join Date
    Apr 2008
    Posts
    189
    georgev: ok, I'm in the Disign view (check the first line).

    I want to do this changes by code because depends on a selection.

    But I cannot find where or how do I need to define the "DefaultView" for a Subform which has the Form with the PivotChart.

    Any ideas how to set it to 4?

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    You opened the report in design view; not the subform.
    George
    Home | Blog

  5. #5
    Join Date
    Apr 2008
    Posts
    189
    Quote Originally Posted by georgev
    You opened the report in design view; not the subform.
    When you open a report in design view, it doesn't open also the subform/form?

    Is there any way to change the "DefaultView" of a Form witout having to open the mentioned form in Design View?
    I mean, avoid doing this:
    Code:
            DoCmd.OpenForm vNombreFormulario, acDesign
            Forms(vNombreFormulario).DefaultView = 4
            DoCmd.Close acForm, vNombreFormulario, acSaveYes
    Thanks!

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    When you open a report in design view, it doesn't open also the subform/form?
    Not when you open the form in design via code it doesn't.

    Is there any way to change the "DefaultView" of a Form witout having to open the mentioned form in Design View?
    Not that I am aware of.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  7. #7
    Join Date
    Apr 2008
    Posts
    189

    Red face

    Mmmm, ok
    Bad news.

    Thanks for your support!

  8. #8
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You could make multiple reports, one in each view, and open the right one accordingly though
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  9. #9
    Join Date
    Apr 2008
    Posts
    189
    Yes, but I just solve it by doing this:

    Code:
            DoCmd.OpenForm vNombreFormulario, acDesign
            Forms(vNombreFormulario).DefaultView = 4
            DoCmd.Close acForm, vNombreFormulario, acSaveYes
    Open the From, changing the DefaultView and Closening it.

    Thanks for the ideas.
    I think I'll do it for another part of the db.

  10. #10
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Glad it's working

    Personally I don't like modifying and saving reports as you're doing. Dunno why... or I don't remember why

    Bloating comes to mind, but there are ways around that.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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