• Window – size to fit form (A97)

    • This topic has 5 replies, 3 voices, and was last updated 23 years ago.
    Author
    Topic
    #368880

    I have a form with some command buttons that run queries and then open a report in preview mode. The form is about five inches by three inches, and it opens in a window sized to fit it. So far, so good.

    The reports open in a window that is too small to be useful – so the natural reaction is to maximize the window. However, when the user then closes the form view (typically after printing) the form loads again – but now it is in a maximized window, leaving the form in the upper left with an ocean of gray around it. The user MAY think to ‘restore’ the window (and then we are all happy) or he may try to close via the “X” close box (and then we are not happy). Either way, it looks very sloppy.

    I have looked for a command that would re-size the window back where it should be that I could attach to the ‘gotfocus’ event – it seems available for controls, but not for the window. Does anyone have any suggestions?

    Viewing 0 reply threads
    Author
    Replies
    • #579130

      In the On Activate event of the form enter Docmd.Restore

      • #579139

        BINGO!

        Thanks, Francois – works like a charm.

        It boggles my mind sometimes: – ask a question in Vancouver, Canada, go to lunch; and get an answer from Belgium!

        • #579142

          If you pay the trip, I bring you the aswer, but you’ll have to wait … say 24 h. Canada is one of the country’s I want to visit someday. laugh

        • #579331

          Hey Dean — if you don’t mind another answer from someone closer to home — also in Vancouver.

          As standard operating practice, I put docmd.maximize in the Open event of all reports, and docmd.restore in the close event. That way you don’t have to worry about which control was used to launch the report.

          • #579734

            Jack –

            I’ll take help from wherever I can get it! Thanks, that was a good suggestion and I will keep it in mind.

    Viewing 0 reply threads
    Reply To: Window – size to fit form (A97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: