Results 1 to 13 of 13
  1. #1
    Star Lounger
    Join Date
    Jun 2004
    Location
    Lambertville, New Jersey, USA
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Backgroung:
    Depending on the data, sometimes I have to generate a "page 2" of a report. Page 2 contains additional data that is sometimes available. When collecting the data into the db, based upon the results, sometimes further "optional" data is collected. When this data is present, then I have to generate page 2 of the report. Currently, page 2, is a seperate report. I control when it's printed based upon the data available in the query. I alwasy run the Page 1 report and depending on the data, I sometimes run the second, Page 2, report.

    Is there any way to create a second page in the same report that I can optionally print based upon the data present in the report query?

    Thanks,
    Lance

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    That's probably doable, but we'd need to know much more to be able to provide more specific help.

  3. #3
    Star Lounger
    Join Date
    Jun 2004
    Location
    Lambertville, New Jersey, USA
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='763344' date='04-Mar-2009 14:46']That's probably doable, but we'd need to know much more to be able to provide more specific help.[/quote]

    The report is a free form report with data seperated in preformatted areas (boxes). It looks just like a data collection form. i.e. not a table based report that has groupings and breaks.

    Due to the preformatting of the data areas - the boxes - I would need to be able to define a section that would optionaly insert a page break and print the rest of the report if specific data was present. i.e. I don't want to print page 2, which would be empty boxes, if the data is not present.

    Any ideas?

    Thanks,
    Lance

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You could create the page break and the controls for the second page, and set the Visible property for all of them to No. By default, the entire second page will be suppressed.

    Write code in the On Open event of the report that sets the Visible property of all controls to True if the condition is met (those on page 1 were already visible but that doesn't matter):
    Code:
    Dim ctl As Control
    If <somecondition> Then
      For Each ctl In Me.Controls
    	ctl.Visible = True
      Next ctl
    End If

  5. #5
    Star Lounger
    Join Date
    Jun 2004
    Location
    Lambertville, New Jersey, USA
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hans;

    That sounds like it could work as long as I print one record at a time. i.e. A given test record may or may no have "page 2" data.

    However, if I print multiple records at a time, i.e. all tests within a time period, then the open event will not work since the page 2 criteria changes from record to record. Are there other events during which I would be allowed to change the control visible properties?

    Lance

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Set the Tag property of the page break and of all controls for the second page to a common value, e.g. P2.

    Use the On Format event of the Detail section instead of the On Open event of the report (assuming that the controls are in the Detail section) and change the code as follows:
    Code:
    Dim ctl As Control
    For Each ctl In Me.Controls
      If ctl.Tag = "P2" Then
    	ctl.Visible = (<somecondition>)
      End If
    Next ctl

  7. #7
    Star Lounger
    Join Date
    Jun 2004
    Location
    Lambertville, New Jersey, USA
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hans;

    Thanks. That should work.

    Lance

  8. #8
    Star Lounger
    Join Date
    Jun 2004
    Location
    Lambertville, New Jersey, USA
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hans;

    That worked - sort of.

    When I have page 2 data, it prints. When there is no page 2 data, nothing prints but I end up with a blank page.

    Any ideas on how to stop the blank page?

    Lance

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Set the Can Shrink property of the Detail section to Yes.

  10. #10
    Star Lounger
    Join Date
    Jun 2004
    Location
    Lambertville, New Jersey, USA
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried that. Still getting a blank second page.
    I also set the page length to really short and really long. Had no effect.

    I'm still trying stuff - looking to see if I'm running over from the Page 1 data - doesn't appear to be - everything that should print is appearing on Page 1 - nothing running over.

    Any further ideas would be much appreciated.

    Thanks,
    Lance

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Try setting the Can Shrink property of the text boxes on page 2 to Yes too.

  12. #12
    Star Lounger
    Join Date
    Jun 2004
    Location
    Lambertville, New Jersey, USA
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Tried it - no luck.

    I'm not sure this can be done. I have a lot of boxes drawn on the report so it looks like a data entry form when printed out. I think those boxes are causing the problem since they can't shrink - they're still there - just invisible. Same goes for labels - no "can shrink" property to set there either.

    I think I'm at a dead end with this one.

    Please let me know if you can think of anything else.

    Thanks for all your help.
    Lance

  13. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Could you post a stripped down copy of your database? See post 401925 for instructions.

Posting Permissions

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