Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Jaron is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    63

    Report print preview asking for criteria on second page

    Here's an interesting situation: I have a report with a sub report, both taken from queries which rely on the same criteria established by a form, which has the command button to call the report in print preview.
    On the button click, the report opens and the form closes, in that order.
    Now, if the sub report contains too many records it automatically gets pushed to the next page, which I don't like but I haven't figured out how to change yet. But that's not the biggest problem.


    When I hit the button to look at page 2 of the print preview, where the subreport is, Access asks for the criteria again. If I choose cancel, it closes the print preview!
    Am I to assume that the report requeries every time I page forward? That seems odd.
    I can avoid the problem by changing the command button code so that the criteria form doesn't close; then I can page thought the report with no problem, since evidently the criteria is still available for the report's query to refer to. The trouble is, the criteria form is set to popup, and it is in the way of the print preview. The only thing I can think of is to make the criteria form 'minimizewindow' when the report opens, and then close when the report closes. I think that will work and I'm going to try it tomorrow, but it seems clumsy. Is it normal for the print preview to behave that way?

  2. #2
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299
    If you need to preview the report prior to printing, why not make it a subreport in the reporting criteria form? Or, you can have the form write the reporting criteria to a table and put the table in the report's query and restrict it that way.

    I attached the example of a subreport relying on the form criteria that I am currently building.
    Attached Files Attached Files

  3. #3
    Jaron is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    63
    Well, that looks like a nice way to do it. But some of it is over my head, and I'd have to do some major re-work to implement it. I'll save your example for use later though, thank you. In the meantime, I came up with a quick-fix. On the criteria form, on button click, I added a line to make the form invisible:

    Code:
    Private Sub Command22_Click()
    On Error GoTo Command22_Click_Err
        
        DoCmd.OpenReport "Report1", acViewPreview, "", "", acNormal
       
        Forms![Criteria1].Visible = False
    
    Command22_Click_Exit:
        Exit Sub
    Command22_Click_Err:
        MsgBox Error$
        Resume Command22_Click_Exit
    End Sub
    Then, in the Report's report close event, I put

    Code:
    DoCmd.Close acForm, "Criteria1", acSaveYes
    Do you see any potential problems with that solution?

    The minimize window idea didn't work; it just minimized to the bottom left where the print preview page selector is and it's just as much in the way there.

    Now if I could just figure out why the subform is getting pushed to the next page.

  4. #4
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299
    I don't think your workaround will be an issue.

    Can you copy and clear out your confidential information and share your database for analysis? I am trying to recreate the issue you described with the subform, and I don't think I am replicating what you described correctly.

  5. #5
    Jaron is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    63
    Ok here you go. There are two sub reports, the last one is just a blank for recipients of the hard copy to fill in by hand and return. It looks like there's enough room for at least one of the subs to go on the same page as the Parent report, but for some reason it doesn't. I found this article: http://support.microsoft.com/kb/938943/en-us and I'm wondering if that is the problem.

    Subreport issue test.zip

    Hopefully this works...I zipped it with a trial version of winzip.

  6. #6
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299
    The problem, I suspect, is because you put the two subreports in the report footer, and the more data you have, the further down the report they will appear.

    Have you thought about adding Groups to the main report instead? You are pulling from the same data source, and with the group breaks, you should be able to get the same formatting you have now. There should be an example of what I am talking about in the database i uploaded previously.

  7. #7
    Jaron is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    63
    I notice though, that the subreports get pushed down even when there is no data in the main report (As when you select "T2" from the criteria form).

    I haven't used grouping too much, as I'm new with Access, so I'll have to do some experimenting with that idea.

  8. #8
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299
    Well, that would be, I suspect, because there is at least a little over 4 inches per report and your margins are set to .25.

  9. #9
    Jaron is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    63
    Sorry, I don't quite understand. If the sub is located in the report footer, not the page footer, its included in the main body of the report under the details. If the main report and the sub are small enough, wouldn't they both fit without the sub getting pushed? I would want my margins to be small right? Theoretically, with .25 margins, I have 8" to work with, so if the main and sub(s) combined are under 8 they should both show up on the same page. Even if I delete the second sub, and it's obvious that there is plenty of room, it still pushes the one sub on to the next page.

  10. #10
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299
    As for the margins, I was typing before thinking...

    I've tried going through and changing settings ('Can Grow', 'Can Shrink', 'Auto Fit', etc.) all over the different reports, and I can't figure what it is. I even recreated the subreports as forms and inserted as subforms and still got the same results. If I get some time over the weekend to do some translation to figure out what everything, I might be able to get a better grasp and give better guidance on possibly using sort to get the desired results.

  11. #11
    Jaron is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    63
    I thought for a minute that I'd fixed it by moving the fields from the main report detail down to the report footer above the subs, then closing off the detail section altogether. It looked the way it should, but then I realized that it wasn't displaying more than one record.

  12. #12
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299
    Check this out. I think this might be it. I also configured your report spec form to not be pop up, and your report to show as a subform. The "Buscar" button is now "Vista Previa".
    Attached Files Attached Files

  13. #13
    Jaron is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    63
    It looks promising, and I think I like the subform way of presenting the information, with a print preview option. I'm not sure if it is doing the same thing in your version, but what I'm seeing is that the 'New Addresses' sub is showing up as it should, tacked on to the end with no white space. However the 'Other addresses by Zone' sub is doing something interesting:
    The page header for the main form shows up once, at the top of the page. Then, each address shows up under it as a separate header. Under each one, the sub "Other addresses..." appears. Not with it's header though, just the page header and the same list, repeated under each main address. Then after all this, the "New addresses" sub shows up complete with it's own header, page header, and rows and appearing only once, which is correct.
    I'm not sure why though, I'm still trying to figure out how everything in your model works together.

    Thanks for all your help on this. If you give up I don't blame you. I'll keep experimenting with your file either way.

  14. #14
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299
    That's how the grouping works - each set of details (or whatever field information you put) will show up as a header. In the "Otras direcciones por zona", I did remove the Report header because it was looking too busy, especially after I formatted the Group heading.

    I grouped on "Nombre" since that was what your sort was, but you can change that to whatever you want. Without having gone back in yet, it might be better to sort on one of the address, however they are selected in each report, then tie them together. I still would like to get in there and translate everything so I can understand better what the end goal is.

  15. #15
    Jaron is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    63
    Ah, ok I see. Yes, sorry about the translation. As far as the end goal, basically for each route, or zone ('zona'), there are two types of addresses (direcciones):
    1. people who are definitely included in the route ('incluso' and confirmado' are the criteria for that scenario). These are the addresses that show up in the main report.
    2. people who are not included. They could be ones who might want to be subscribed but need follow up to clarify ('seguimiento requerido'), or who used to be, or who have declined altogether. Regardless of the exact situation, they all show up in the second list, 'Other addresses in this zone' ('Otra direcciones en este zona').

    Before field personnel run a route, they will receive an updated report from the dispatcher. They definitely visit addresses in the first list, but only might visit addresses on the second list, depending on the details in the notes field ('notas'). The second sub form, with the blanks, is basically just provided for the field personnel to communicate new information to the person maintaining the DB.

    Hopefully that provides some context. That's why showing the second list repeated under each entry of the main list is not the best way to organize the data.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. convert report view to print preview
    By DarrenUD in forum Reports
    Replies: 3
    Last Post: 03-19-2013, 12:21 AM
  2. Replies: 6
    Last Post: 02-02-2013, 12:44 AM
  3. Replies: 2
    Last Post: 02-08-2012, 01:03 PM
  4. Replies: 1
    Last Post: 04-21-2011, 01:58 PM
  5. Can't see sub report in print preview
    By LoggyDoggy in forum Access
    Replies: 1
    Last Post: 04-20-2010, 05:38 PM

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