[AccessD] Can't suppress subreport

Susan Harkins ssharkins at bellsouth.net
Mon Aug 9 08:26:10 CDT 2004


 

So what you are trying to say is that the label should be set Visible or not
just like the subreport?

=====Report.rptMissingRecordsub.Visible = False === Right, it's the
subreport I'm toggling off and on. 

If so, is the label invisible if you manually (in report design) make the
subreport not visible? 

The subreport is actually printing before the current record -- which makes
it look like there's a spot for the missing record, when there really isn't
-- when there's no missing record, the subreport doesn't print and the
Detail section shrinks accordingly. 

It's really a very very simple little routine and it works great, except for
this one problem. Odd. 

=====Yes. 

Interestingly, another report that uses slightly different code works as
expected, so I can only summise that it's in that counter, but I can't
figure it out. I've walked through it and the condition works as expected,
but when I run it right out, it prints the subreport just above the first
record. The rest of the report works as expected. 

Below is the procedure that works -- same records, but different condition
and the subreport prints only where it's supposed to. In this report, it
prints on top of the record. 

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  'Display warning text if product is discontinued.
  If Discontinued = -1 Then
    Report.rptDiscontinuedsub.Visible = True
  Else
    Report.rptDiscontinuedsub.Visible = False
  End If
End Sub


> The following procedure prints a "Missing Record" label in a subreport 
> when there's a missing AutoNumber value -- I've based this particular 
> example on the Products table in Northwind. It works fine, except for 
> one thing -- it prints the subreport label text at the beginning of 
> the Detail section -- before the first record. For the life I've me, I
can't seem to shut it up!
> The subreport is positioned at the beginning of the Detail section, 
> just above the actual controls.
 
> Susan H. 
 
 
> 'Track record ProductID values.
> Public lngMissingRecordFlag As Long
 
> Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
>   'If current record isn't one more than flag, print warning.
>   Dim lngRecordCounter As Long
>   lngRecordCounter = ProductID.Value
>   If lngMissingRecordFlag = (lngRecordCounter - 1) Then
>     Report.rptMissingRecordsub.Visible = False
>   ElseIf lngMissingRecordFlag <> (lngRecordCounter - 1) Then
>     Report.rptMissingRecordsub.Visible = True
>   End If
>   lngMissingRecordFlag = lngRecordCounter End Sub

--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list