G
Guest
I have a report which returns a series of records for which I wish to
suppress the duplicate values for a few fields. The "Hide Duplicate"
attribute will only hide the duplicates on a single page of the report. I
which to hide all duplicates for like values throughout the report.
My VB skills are weak (ok practically non-existant); however, I inherited
this DB from someone who's code kind of works, but not in all instances.
Data Structure for the Report is:
FunctionOrder, Function, ActivityOrder, Activity, Risk.
Each Function may contain mulitple Activities.
Each Activity may contain multiple Risk.
I wish to supress the display for the FunctionOrder, Function,
ActivityOrder, and Activity for all but the first record.
Below is the code I inherited, it kind of works. On some pages the
FunctionOrder, Function, ActivtyOrder, and Activity repeat. I am resonably
sure it occurs when a new activity starts on a new page and the risks
associated to the Activity can not fit on the page.
Any suggestions would be greatly appreciated.
Code:
---------------
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' Declaring Function and pageno variables locally and as static
' So that if another report is running at same time, it will not use them
' as it might had they been declared publicly or with the same
' name as in the other report.
' Note - this report has code which controls manually when and where the
' "F-", the function order and the function print on the page.
' To handle this manually or programmatically, the code gets somewhat
complicated.
' One aspect handled is the suppression of this function information on the
' next page when a function begins on the previous page and continued to the
next
' page.
Static strrptRIAFunction As String
Static strrptRIAActivity As String
Static reccount As Integer
'set line width
Me.DrawWidth = 10
'create gridlines
Me.Line (0, 0)-(0, 15000)
Me.Line (3115, 0)-(3115, 15000)
Me.Line (6780, 0)-(6780, 15000)
Me.Line (8980, 0)-(8980, 15000)
Me.Line (9540, 0)-(9540, 15000)
Me.Line (11830, 0)-(11830, 15000)
Me.Line (14300, 0)-(14300, 15000)
Me.Line (15110, 0)-(15110, 15000)
' Defines the Text Fields used to designate Function and Activity (prefix
for FunctionOrder and ActivityOrder
Me.Text14 = "F-"
Me.Text101 = "A-"
' Set default of visible
Me.Text14.Visible = True
Me.Function.Visible = True
Me.FunctionOrder.Visible = True
Me.Text101.Visible = True
Me.ActivityOrder.Visible = True
Me.Activity.Visible = True
' Set Visibility
If Me.Function.OldValue <> strrptRIAFunction Then
Me.Text14.Visible = True
Me!FunctionOrder.Visible = True
Me!Function.Visible = True
End If
If Me.Function.OldValue = strrptRIAFunction Then
Me.Text14.Visible = False
Me!FunctionOrder.Visible = False
Me!Function.Visible = False
End If
If Me.Activity.OldValue <> strrptRIAActivity Then
Me.Text101.Visible = True
Me!ActivityOrder.Visible = True
Me!Activity.Visible = True
End If
If Me.Activity.OldValue = strrptRIAActivity Then
Me.Text101.Visible = False
Me!ActivityOrder.Visible = False
Me!Activity.Visible = False
End If
strrptRIAFunction = Nz(Me.Function.OldValue)
strrptRIAActivity = Nz(Me.Activity.OldValue)
End Sub
suppress the duplicate values for a few fields. The "Hide Duplicate"
attribute will only hide the duplicates on a single page of the report. I
which to hide all duplicates for like values throughout the report.
My VB skills are weak (ok practically non-existant); however, I inherited
this DB from someone who's code kind of works, but not in all instances.
Data Structure for the Report is:
FunctionOrder, Function, ActivityOrder, Activity, Risk.
Each Function may contain mulitple Activities.
Each Activity may contain multiple Risk.
I wish to supress the display for the FunctionOrder, Function,
ActivityOrder, and Activity for all but the first record.
Below is the code I inherited, it kind of works. On some pages the
FunctionOrder, Function, ActivtyOrder, and Activity repeat. I am resonably
sure it occurs when a new activity starts on a new page and the risks
associated to the Activity can not fit on the page.
Any suggestions would be greatly appreciated.
Code:
---------------
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' Declaring Function and pageno variables locally and as static
' So that if another report is running at same time, it will not use them
' as it might had they been declared publicly or with the same
' name as in the other report.
' Note - this report has code which controls manually when and where the
' "F-", the function order and the function print on the page.
' To handle this manually or programmatically, the code gets somewhat
complicated.
' One aspect handled is the suppression of this function information on the
' next page when a function begins on the previous page and continued to the
next
' page.
Static strrptRIAFunction As String
Static strrptRIAActivity As String
Static reccount As Integer
'set line width
Me.DrawWidth = 10
'create gridlines
Me.Line (0, 0)-(0, 15000)
Me.Line (3115, 0)-(3115, 15000)
Me.Line (6780, 0)-(6780, 15000)
Me.Line (8980, 0)-(8980, 15000)
Me.Line (9540, 0)-(9540, 15000)
Me.Line (11830, 0)-(11830, 15000)
Me.Line (14300, 0)-(14300, 15000)
Me.Line (15110, 0)-(15110, 15000)
' Defines the Text Fields used to designate Function and Activity (prefix
for FunctionOrder and ActivityOrder
Me.Text14 = "F-"
Me.Text101 = "A-"
' Set default of visible
Me.Text14.Visible = True
Me.Function.Visible = True
Me.FunctionOrder.Visible = True
Me.Text101.Visible = True
Me.ActivityOrder.Visible = True
Me.Activity.Visible = True
' Set Visibility
If Me.Function.OldValue <> strrptRIAFunction Then
Me.Text14.Visible = True
Me!FunctionOrder.Visible = True
Me!Function.Visible = True
End If
If Me.Function.OldValue = strrptRIAFunction Then
Me.Text14.Visible = False
Me!FunctionOrder.Visible = False
Me!Function.Visible = False
End If
If Me.Activity.OldValue <> strrptRIAActivity Then
Me.Text101.Visible = True
Me!ActivityOrder.Visible = True
Me!Activity.Visible = True
End If
If Me.Activity.OldValue = strrptRIAActivity Then
Me.Text101.Visible = False
Me!ActivityOrder.Visible = False
Me!Activity.Visible = False
End If
strrptRIAFunction = Nz(Me.Function.OldValue)
strrptRIAActivity = Nz(Me.Activity.OldValue)
End Sub