Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sizing and floating a Window? (2002)

    I have a form frmReports. On it there is a listbox on the right 1"x6". vertical
    I have an Subform that I use to show various lists etc. By just clicking on the listbox I can pull-up any list in the subform and rapidally see various lists..
    I can change the subform to an OLE field and then show various graphs.
    THE problem is I can't do it with reports. I tried the snapshot viewer and it seems a bit hookey.
    I can open a report with a macro and float it to the left but the print is very small.
    I don't know all the code to float the window above frmReport, get it larger and use the list box to select the other reports and keep it in the foreground.
    I'd like to have the window of the report about 2/3's of the screen and the listbox on the form in the background to show 1/3 on the right and just stay there while I select reports in the list box.
    I need also a button to close the report window. (More elegant than the window close button)
    Hope this is not confusing.
    Frank

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sizing and floating a Window? (2002)

    Take a look at DoCmd.MoveSize. It takes four arguments: left, top, width and height, all in twips (1 inch = 1440 twips, 1 point = 20 twips). It acts on the active window, so you must select it first. For example:

    DoCmd.SelectObject acReport, "rptMyReport"
    DoCmd.MoveSize 5 * 1440, 2 * 1440, 4 * 1440, 3 * 1440

    selects a report rptMyReport, sets the top left corner to 5 inches from the left side and 2 inches from the top, and resizes it to 4 inches wide by 3 inches high.

    You can't put a command button on a report. Or rather, you can, but it won't work. The user can always use the Escape key to close a report. The alternative is to create a custom tool bar with a close button, and attach it to the report by setting the ToolBar property of the report.

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sizing and floating a Window? (2002)

    Hi Hans.
    I get an error message rptVendorsList is not open.
    I tried:
    Private Sub Command858_Click()
    DoCmd.OpenReport "rptVendorsList", acViewPreview
    DoCmd.SelectObject acReport, "rptVendorsList"
    DoCmd.MoveSize 5 * 1440, 2 * 1440, 4 * 1440, 3 * 1440
    End Sub

    Opens rptVendorsList first in max view only.
    Frank

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sizing and floating a Window? (2002)

    Of course, you must open a report before you can refer to it. If your report opens maximized, you can restore it with

    DoCmd.Restore

    before setting its position and size.

  5. #5
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Sizing and floating a Window? (2002)

    I normally open reports maximized at 100% zoom, with form hidden, most reports (the ones I design anyway) wouldn't be too useful at a smaller zoom setting or opened in restored window. If the report's "print is too small" then use Zoom command to specify zoom setting. Example:
    <pre> Dim strRpt As String
    strRpt = "My Report"

    DoCmd.OpenReport strRpt, acViewPreview
    DoCmd.SelectObject acReport, strRpt
    DoCmd.RunCommand acCmdZoom100</pre>


    This opens report in print preview at 100% zoom. In Access 2002 the following acCmdZoom settings are available: 10, 25, 50, 75, 100, 150, 200, 500, 1000. (I'm not sure why you would open report at 1000% zoom.) Earlier versions of Access have a few less Zoom options.

    PS - The form you are using to open reports should be defined as pop-up form if you want it to stay on top of other open windows (such as report in print preview). As noted, I normally hide the pop-up form, and add code to report so when report is closed from print preview window the pop-up form becomes visible again to allow user to select a different report option.

    HTH

  6. #6
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sizing and floating a Window? (2002)

    Hi All.
    As usual your solutions and code are impeccable.
    I forgot all about the popup form's ability to stay on top. Previously I found some code at microsoft for keeping a window on top using handles etc. The popup is the most simplist.
    Frank <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>

Posting Permissions

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