Want Report View to look like Print Preview

ions

Access User
Local time
Today, 10:51
Joined
May 23, 2004
Messages
823
Dear Access Expert,

I have the following code in the On Format Event of the report. It is used to hide duplicates which result from very loose Where parameters when I run Docmd.OpenReport. With tighter Where parameters there are no Duplicates.

I am aware that the On Format event does not fire and I am to use the On Paint event. However, the On Paint Event seems very limited. It does not have a Cancel and most code that i tried does not work.

Is it possible to get the same behavior in Report View?

Code:
Private strLastGen As String 'Report Module Variable
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    
     'If a duplicate Generator
    If Me.GeneratorNumber & Me.GeneratorName = strLastGen Then
       Cancel = True
    End If
    ' Save the Gen Num of this record
    strLastGen = Me.GeneratorNumber & Me.GeneratorName

End Sub

Thank you.
 
Why not eliminate the duplicates in the query by using group by.
 
Pat because I am using a user defined predicate for the Where parameter when I open the report. If the predicate is loose it will create duplicates (which is actually correct but I don't want to show duplicates) if the Predicate is fine it will not produce duplicates. This methodology allows me to use one report and one master query.
 
Having the group by won't alter the results from the specific predicate.

The Report View doesn't fire all the events so there are limits to what you can do in the Report events.
 
Hi Pat,

The only way to get the Report View working was to remove the duplicates in the SQL as you suggested.

Thanks,
 
I'm sure that MS has some reason for having the Report View not execute the report events but it sure makes it useless for most of my outputs.
 
It's too powerful to ignore though. Print Preview is not great in certain areas. You can't scroll through the report and you can't select any text into the clipboard. You also can't trigger any events from it like Click etc... making it non interactive.
 

Users who are viewing this thread

Back
Top Bottom