MS Access 2007 - Using Subforms in Reports

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • VivDenham
    New Member
    • Dec 2008
    • 44

    #1

    MS Access 2007 - Using Subforms in Reports

    Hi there

    In MS Access 2007, I have a Form which contains fields that are Visible = False in certain circumstances, and this works perfectly.

    When I use this form as a Subform in another form, this also works perfectly and the "hides" shown when appropriate.

    I would like to use this same Subform in a Report, but the "hides" do not work correctly in the Report.

    Am I asking the impossible?

    Many thanks for your advice

    Viv"
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    What code are you using and in which event(s) in the form?

    Linq ;0)>

    Comment

    • VivDenham
      New Member
      • Dec 2008
      • 44

      #3
      Hi

      I am using code like

      Field A.visible = false

      and then later

      If something matches something else then

      Field A.visible = true

      On the Form, I am using this code on On Current, but I have also tried it on virtually everything else - on Unload, on Load, - everything.

      When I embed this form as a subform in a bigger Form, it works perfectly, with the hides and reveals working correctly.

      However, if I try to embed this form as a subreport (in a Report) then the hides and reveals just do not work. My son tells me that this is because the Report does not know which is the Current record (i.e. the code is On Current in the form). However I have tried also putting the code into the Report in the On Print and On Format events, but I just get a message that "Field A does not appear on this Report" which is quite correct, the field is not on the report but on the original form which now appears as subreport.

      I think I am trying to do the impossible, but it would be so nice if it would work. All I am trying to do is to have data in Form A and be able to print that data into a Report.

      However, if I change the layout of Form A, it would be good if the layout of the subreport would automatically also be changed (because it is the form really) - whereas at the moment I have to keep a copy of the original form and then paste everything into a Report - and remember to make the changes to the Report each time I change the Form.

      Any ideas?

      Viv

      Comment

      • VivDenham
        New Member
        • Dec 2008
        • 44

        #4
        Originally posted by missinglinq
        What code are you using and in which event(s) in the form?

        Linq ;0)>
        Hi

        I am using code like

        Field A.visible = false

        and then later

        If something matches something else then

        Field A.visible = true

        On the Form, I am using this code on On Current, but I have also tried it on virtually everything else - on Unload, on Load, - everything.

        When I embed this form as a subform in a bigger Form, it works perfectly, with the hides and reveals working correctly.

        However, if I try to embed this form as a subreport (in a Report) then the hides and reveals just do not work. My son tells me that this is because the Report does not know which is the Current record (i.e. the code is On Current in the form). However I have tried also putting the code into the Report in the On Print and On Format events, but I just get a message that "Field A does not appear on this Report" which is quite correct, the field is not on the report but on the original form which now appears as subreport.

        I think I am trying to do the impossible, but it would be so nice if it would work. All I am trying to do is to have data in Form A and be able to print that data into a Report.

        However, if I change the layout of Form A, it would be good if the layout of the subreport would automatically also be changed (because it is the form really) - whereas at the moment I have to keep a copy of the original form and then paste everything into a Report - and remember to make the changes to the Report each time I change the Form.

        Any ideas?

        Viv

        Comment

        Working...