Full Version: Msg While Formatting Report In Print Preview And In Report View
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
dipetete
Good evening,

I have a huge report that takes sometime in get formatted.

Is there a way I can capture in a message or in a progress bar or something the formatting process?

I'm a little bit lost with this, and don't know how to approach it.

I know how to create a simple progress bar with rectangles for example, but still need something to count for filling them.

I tried to capture the FormatCount property of the Format event of the report unsuccessfully.

Thanks in advance
dipetete
This works well, but still I need to close the recently opened form.
Any idea about how to close the form when the formatting is complete?
CODE
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If CurrentProject.AllForms("formateando").IsLoaded = True Then
    If [Forms]![formateando]![Label0].BackColor = vbRed Then
        [Forms]![formateando]![Label0].BackColor = vbGreen
        DoEvents
    Else
        [Forms]![formateando]![Label0].BackColor = vbRed
        DoEvents
    End If
Else
    DoCmd.OpenForm "formateando", acNormal
    DoEvents
End If
End Sub

Regards,
Diego
zocker
Have you looked at SysCmd? Itshows a progress bar as part of the database window, you should be able to drive it from the Report's events.

Saludos y suerte!


Zocker
dipetete
Hey Zocker,
Yeap, I checked it.
In fact I'm playing a little bit with it, but I don't get how to use it in this case.
This is what I just did
CODE
ObjectState = SysCmd(acSysCmdGetObjectState, acReport, "t1")
If ObjectState <> 3 Then
    DoCmd.Close acForm, "formateando", acSaveNo
End If
Debug.Print ObjectState

However, the objectstate is always 3, so that doesn't work.
How do you propose I should use SysCmd?
Regards,
Diego
PS: Gracias wink.gif
zocker
Some time since I used it, I'll have a look at Msoft KBase!

There's sample code from Msoft HERE that you can use for your report.



Z
dipetete
Yeah thanks,
I know how to set the status bar.
That's no a problem.
Even with the code I showed before I can display a message while the report is being formatted.
Now, what I need is a way to close mys custom form that is displaying the message "formatting".
So I need to find an event or something that triggers the DoCmd.Close macro when the formatting is completed.
I had tried several events. The closest I came to solve this is as follows:
CODE
Private Sub Report_Deactivate()
DoCmd.Close acForm, "formateando", acSaveNo
End Sub

However, in order to close the form, I have to close the print preview as well.
This is better than nothing, because I just need to click close on the report print preview, but I would like that the form closes automatically after the formatting is complete.
Thanks,
Diego

PS:
Another thing that may help me is to know how the SysCmd is activated and deactivated when a report is under formatting.
dipetete
This is the sequence of events that trigger while the report is being formatted:
1.- Report Open
2.- Report Load
3.- Report Resize
4.- Report Activate
5.- Report Got Focus
' Triggers the Formatting
6.- Form Open
7.- Form Load
8.- Form Resize
9.- Form Current
10.- Form GotFocus
' Performs the Formatting
' I close manually the Print Preview
11.- Report Lost Focus <-- I thought it was the Deactivate event, but is this instead.
' Closes automatically the Form
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.