Results 1 to 9 of 9

Thread: Message Box

  1. #1
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Message Box

    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.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Message Box

    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.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message Box

    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?
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message Box

    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 <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

  5. #5
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Message Box

    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.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  6. #6
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message Box

    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.

  7. #7
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Message Box

    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!<g>
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  8. #8
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message Box

    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.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

  9. #9
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message Box

    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. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

Posting Permissions

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