• Message Box

    Author
    Topic
    #357092

    Access 2000

    I have an form containing the names of all my reports. I used the rectangle tool to create yellow colored boxes for preview and green colored boxes for printing. In the click event of each boxI placed the following code: DoCmd.OpenReport “ReportName”, acViewPreview

    Because some of my reports are complex they may take as long as 60 seconds to display or print. No hourglass appears so a user may think nothing is happening. I tried adding the following code before my code to open the report: DoCmd.Hourglass true

    The problem with this method is that the hourglass does not appear until after the report has opened. Can anyone tell me how to change the code to get the result I want of immediately displaying the hourglass when the box is clicked and then turning the hourglass off as soon as the report is fully loaded or printed.

    My next thought was to create a messagebox to tell the user to be patient while the report is loading but I don’t want them to have to click OK and the report does not begin loading until they do. Is it possible to create a messagebox and use a timer to turn it off automatically after a few seconds. If so, can you steer me in the right direction for the code.

    Viewing 0 reply threads
    Author
    Replies
    • #529772

      You might try putting a DoEvents right after the DoCmd.Hourglass. Sometimes this helps.

      As for not wanting to use a message box, why not just create a “splash” screen with a “Waiting for report to load!” message. You can set the TimerInterval for as long as you want, and put a DoCmd.Close in the OnTimer Event.

      • #529788

        I tried using the DoEvents code testing the same scenario on the Northwind database. The hourglass flashed for a moment but did not stay on until the report appeared. Of course their reports don’t take quite as long to appear. I’ll try it on mine at work tomorrow.

        I would be interested in the splash screen. How is that created?

        • #529789

          Hi Judy,
          Another idea is to use the Echo method (of the DoCmd object). You can turn off the activity on the screen, but you can also set the Status bar text telling the user to be patient while the report is formatting.

          Yet another suggestion is to use the SysCmd method to create a progress bar (in the status bar area). This can be tricky because you’ll have to sync the UpdateMeter commands with the Format events of your report. I have a few examples of this that I could send you if you’re interested (too big to post).

          HTH thumbup

          • #529812

            Please send me the examples you have of using the progress meter. Even if I don’t use them for this problem, there have been several times I wished I knew how to do that. I want you to know that the calendar you provided sometime ago is attached to the doubleclick event of every date field in my application.

            As Mark Liquorman suggested, I created a form screen about an inch high by 6 inches long to ask the user to be patient while their report is being prepared and entered the code for it to open just prior to the code that opens the report. As you suggested, I inserted the code to close this form from the page event of the report. At this time I am testing this on the Northwind database but it looks like it will do what I want.

            Thanks to both of you for your help.

            • #529817

              Hi Judy, unfortunately the database is a bit too large to post here. I’ll email it to you.

              If anyone else is interested, please ask. I’ll be happy to email it. grin

        • #529793

          I assume your code looked like this:
          docmd.hourglass true
          docmd.openreport ……..
          docmd.hourglass false

          You have to realize that Access doesn’t stop processing the procedures while the report is opening. It spins that off as a separate task, then continues on with the next line of code (turning the hourglass off). You might try turning the hourglass off in your report code, but I’m not sure that would help much.

          A “splash” screen is what you often see as the first screen in an application (showing title, etc.), that automatically disappears after awhile. Merely create a form that has on label on it, and put in nice large letters some caption to the effect of “Please be patient, the report is processing!”. In your form’s TimerInterval, put a value of 5000 (this is 5000 milliseconds, which is 5 seconds) or whatever value you want. Create an Event Procedure for the OnTimer event with the single line of code:
          DoCmd.Close

          That’s all it takes. If you get real ambitious, you could pass a parameter in the form’s Arguements property that sets the TimerInterval accordingly.

          • #529797

            Re: Splash screen
            Since some computers will process and display the report more quickly than others, it may be a good idea to close the Splash Screen form in the Report’s OnPage event rather than using a timer. That should work for either Print Preview or Printing the report.

            • #529804

              Since I don’t have any large reports like Judy mentioned (that take 60 seconds to display), I can’t say this will work. That’s why I said it may be possible to put it in a report’s event. This event might still fire before the report displays. Unforunately there is no AfterReportHasDisplayed event!

    Viewing 0 reply threads
    Reply To: Message Box

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

    Your information: