Results 1 to 9 of 9
  1. #1
    JHart2016 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2017
    Posts
    4

    Question Report Window Size

    I am having trouble getting a report window to display the correct size so the user doesn't have to scroll the window. There are actually two reports that are physically the same size. With the exception of some content they are identical. I have checked all the properties of both and they are the same. I have re-sized and saved in design, layout and print preview and still can't get both to appear on the screen the same size. The weird thing about this is the report that is called first opens too big. If I just change the order in which they are called, it's always the one called first that is too big.
    Code:
        If chkLawTags.Value = True Then
            'open foundation label preview
            strDocName = "Foundation LabelRPT"
            DoCmd.OpenReport strDocName, acViewPreview, , , acWindowNormal
            DoCmd.RunCommand acCmdFitToWindow
            'open mattress label print preview
            strDocName = "Mattress LabelRPT"
            DoCmd.OpenReport strDocName, acViewPreview, , , acWindowNormal
        End If
    This code is executed in a button click event and if the user selects two other reports will open (print preview) as well. Only one of these gives me a problem depending on which one is called first, foundation labelrpt or mattress labelrpt. In this code I am using the same variable, but have used different ones. Also, have tried without the acWindowNormal and without acCmdFitToWindow. To make things even harder perhaps, this used to work, I don't know what could have changed. Hope someone can help, can't think of anything else to try.
    Thanks



  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    you aren't running the docmd.runcommand accmdfittowindow on the second window to open

  3. #3
    JHart2016 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2017
    Posts
    4
    Thanks, but that's not it. I might not have been clear enough. The problem might not be in the actual report but rather the window the report displays in. If I make absolutely no changes other than the order in which the reports are called, it's always the first one that displays in a bigger window. In other words I have two reports named foundation labelrpt and mattress labelrpt. If I call foundation labelrpt first, that one displays bigger than the mattress labelrpt. If I call mattress labelrpt first, it displays bigger than foundation labelrpt. If I make a copy of foundation labelrpt and call it first, the orginal foundation labelrpt and mattress labelrpt display correctly. In layout view, or design view I can size the window very large or very small and the first report called always displays bigger than the others. Not sure how well you can see this but here is a screen shot of the two reports. If I called the one on the right again it would be the same size as the one on the left. Again, it's only and always the first one called that displays bigger. Thanks again.
    Click image for larger version. 

Name:	report.jpg 
Views:	18 
Size:	68.5 KB 
ID:	26956

  4. #4
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,361
    What's not clear to me is whether or not you are altering the window size of the first report before you open the second report. That would be important.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    JHart2016 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2017
    Posts
    4
    Another screen shot of the output. The reports are displayed left to right in the order they are called. Copy is just that a copy of the foundation report with absolutely no design changes. The code calling these reports follows.
    Click image for larger version. 

Name:	report1.jpg 
Views:	16 
Size:	81.1 KB 
ID:	26958
    Code:
        If chkLawTags.Value = True Then
            'open label reports
            strDocName = "Copy Of Foundation LabelRPT"
            strDocName1 = "Mattress LabelRPT"
            strDocName2 = "Foundation LabelRPT"
            DoCmd.OpenReport strDocName, acPreview
            'DoCmd.Maximize
            DoCmd.RunCommand acCmdFitToWindow
            
            DoCmd.OpenReport strDocName1, acPreview
            'DoCmd.Maximize
            DoCmd.RunCommand acCmdFitToWindow
            DoCmd.OpenReport strDocName2, acViewPreview
            'DoCmd.Maximize
            DoCmd.RunCommand acCmdFitToWindow
        End If
    doCmd.Maximize is commented out because the idea is to get both reports visisble on the screen without the user having to scroll them. In design or layout view the windows are sized the same. Not sure what you mean by altering the size of the first report before opening the second. My intention is that they are exactly the same size. If I call the mattress labelrpt (middle) first, it will display as the bigger report. And the same if I call the Foundation LabelRPT, it will display bigger. It has something to do with the report that is called first. This is very annoying, so I appreciate all the help. If something is still not clear please let me know, not sure if I can let this go. It is just a cosmetic inconvenience.
    Last edited by JHart2016; 01-07-2017 at 06:59 PM. Reason: get rid of extra image

  6. #6
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,361
    Not sure what you mean by altering the size of the first report before opening the second.
    I meant that the first report opens, you resize the window with the mouse then open the second. However, I see that what's going on here is successive opening of reports with no type of user interaction occurring in between.

    The usual suspects would be dis-similar page margins, page widths or paper sizes (might only be applicable to print preview). However the fact that altering the opening sequence causes the issue to occur with a different report indicates these are not the cause. I also ruled out that you have a report event (such as Format event) on one but not the other. I have only 3 suggestions at present
    - one at at time, open in design view, ensure the window is maximized and save the report (either ribbon icon or Ctrl+S). Then retest.
    - control the position and size with vba; DoCmd.MoveSize method
    - compact db, copy db if it has sensitive data, replace with dummy data if that's an issue, ZIP it and post here. At least someone might come up with the cause, which we both probably would like to ascertain even though the movesize method would likely fix it. Note that if the db contains any features incompatible with version 2007, I may not be able to open it; I certainly will not be able to work with it in design mode.

  7. #7
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,361
    FYI: declaring the name of a report or form object as a string then invoking a command using that string is a macro conversion thing. Not that it's a bad, but it's not necessary and adds verbiage. I concede that it's a decent way to learn vba, just know that this can be accomplished with less typing.
    Code:
    If chkLawTags.Value = True Then
       'open label reports
       DoCmd.OpenReport "Mattress LabelRPT", acPreview
       DoCmd.RunCommand acCmdFitToWindow
    
       DoCmd.OpenReport "Foundation LabelRPT", acViewPreview
       DoCmd.RunCommand acCmdFitToWindow
     End If
    Also suggest you try opening in PrintPreview mode to see if that alters the window behavior.

  8. #8
    JHart2016 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2017
    Posts
    4
    I wanted to take a moment and thank you for your help. The DoCmd.MoveSize method worked great. Programming is just a hobby for me, I got into this because a application at work quit working and the company that wrote it didn't support it anymore and the individual who does is hard to get a hold of. I tinker around with visual basic from time to time, but really nothing with access and vba, so I had to learn as I wrote it. Thanks again.

  9. #9
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,361
    You're welcome. I pretty much learned the same way, although I do have a reliable source I can turn to when I need it.
    It's a good thing he's my kid (though he's hardly a kid anymore).
    Can you mark this one as 'solved'?
    Thanks.

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

Similar Threads

  1. Table/Query window size too big
    By csdlman in forum Access
    Replies: 15
    Last Post: 03-27-2021, 10:29 AM
  2. Size of Access Window set to Fom size
    By MrDummy in forum Access
    Replies: 2
    Last Post: 06-26-2016, 05:18 AM
  3. Controlling the window size of a pop up form
    By Aaron5714 in forum Forms
    Replies: 5
    Last Post: 11-29-2012, 01:23 PM
  4. Replies: 1
    Last Post: 01-14-2010, 04:10 PM
  5. Set IE window size using followhyperlink
    By AndrewAfresh in forum Access
    Replies: 0
    Last Post: 11-23-2006, 12:22 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