[AccessD] Control size of Report Preview window

Bill Patten bill_Patten at earthlink.net
Sat Aug 26 20:50:16 CDT 2006


Fred,

Thanks for keeping me posted. I played with the code, and once I found the 
clFormWindow and figured out the API calls think that isZoomed and IsZoomed 
are different I got it working. I think it is much more elegant than my 
solution but am keeping mine for this project because if a whole page is 
displayed on the screen the text is too small for my client to read. Since 
most of the time the report is only a few rows long it is better to be wide 
and short so the text is bigger.

I think what you came up with may be useful for other forms and or reports 
so I shall add it to on of my regular modules.

Bill
----- Original Message ----- 
From: "Fred Hooper" <fahooper at trapo.com>
To: "'Access Developers discussion and problem solving'" 
<accessd at databaseadvisors.com>
Sent: Saturday, August 26, 2006 10:41 AM
Subject: Re: [AccessD] Control size of Report Preview window


Hi Bill,

I've found some move/size code that I like better. It's at
http://www.mvps.org/access/forms/frm0042.htm. The big difference is that it
makes Parent dimensions easily available. It also works for reports where my
use of it is screen resolution independent.

You will note that I'm using acCmdFitToWindow instead of acCmdZoom75, as it
allows the largest print that will show a full page in the window.

My code is now:
Public Sub SizeAndCenterReport(strReport As String)
    Dim booZoomed As Boolean
    Dim fwForm As clFormWindow

    If ReportIsOpen(strReport) Then
        If Not IsZoomed(Reports(strReport).hWnd) Then
            Set fwForm = New clFormWindow
            With fwForm
                .hWnd = Reports(strReport).hWnd
                .Top = 0
                .Height = .Parent.Height - 5  'Avoids a vertical scroll bar
                .Width = .Height * 8.5 / 11
                .Left = (.Parent.Width - .Width) / 2
            End With
            Set fwForm = Nothing
            RunCommand acCmdFitToWindow
      End If
    End If
End Sub

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Patten
Sent: Thursday, August 24, 2006 10:06 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Control size of Report Preview window

Hi Fred,

I'll keep that url for future reference, but my method seems to be working
ok. When certain employees log into my app, if there are any open
requisitions I have a report pop up on the screen. Maximize seems to confuse

them and they always hit the wrong x in the upper right hand corner to
close. So I set the report to 75% and now set the report window to about 3/4

the size of the screen. They can easily scan the report before closing it
and doing what ever the got into the program to do.

Lots of good info in that article.

Bill
----- Original Message ----- 
From: "Fred Hooper" <fahooper at trapo.com>
To: "'Access Developers discussion and problem solving'"
<accessd at databaseadvisors.com>
Sent: Thursday, August 24, 2006 5:35 PM
Subject: Re: [AccessD] Control size of Report Preview window


Hi Bill,

I've fiddled a bit with the code at
http://support.microsoft.com/default.aspx?kbid=210141 (which uses MoveSize)
that is designed for sizing forms and I was able to make it work for the
reports just by changing the input specification from Form to Report (and be
dual-purpose by using Object).

However, my problem with this approach is that I haven't found an equivalent
to the On Unload event for reports to save the size that user adjusts to. I
haven't experimented yet with the events; perhaps the On Deactivate event
will work. If not, I'll either maximize it or follow your approach.

Fred

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Patten
Sent: Thursday, August 24, 2006 6:47 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Control size of Report Preview window

Fred

I have been fighting the same problem, I don't want the form to maximize but

want it to open large enough so that the user can read it without having to
adjust the size. This is working much better than stock. I haven't finished
testing it so no comments from my client as yet but it might help you solve
your problem. use docmd.movesize

 Dim stDocName As String

    stDocName = "rptRequisitionStatus"
    DoCmd.OpenReport stDocName, acPreview
    DoCmd.RunCommand acCmdZoom75
    DoCmd.MoveSize , , 11800


Play with the 1180 and be sure to check it on different resolution screens.

HTH

Bill
----- Original Message ----- 
From: "Fred Hooper" <fahooper at trapo.com>
To: "'Access Developers discussion and problem solving'"
<accessd at databaseadvisors.com>
Sent: Thursday, August 24, 2006 2:39 PM
Subject: [AccessD] Control size of Report Preview window


Is there any way to control the size of the report preview window?

Runcommand acCmdZoom (10 ... 200) controls the size of the printing in the
window but doesn't control the size of the window.

Manually sizing the window and pressing the save button "kind of" works, but
the window gets progressively smaller as the front end is repeatedly
compacted and repaired. Also, when it's moved to a machine with a lower
resolution monitor it further shrinks.

Is there something using twips (like there is for forms) that I can read,
save & apply so the report preview window will be the same inch/cm
dimensions on all monitors, regardless of their resolution?

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list