Help: hide/unhide sub-report

associates

Registered User.
Local time
Today, 05:20
Joined
Jan 5, 2006
Messages
94
Hi,

I have a report that has a sub-report (sub-report1) in it. Based on the value of a field say studID, i'd like to be able to hide/unhide the sub-reports.

What i'd like to see in the report is
StudID 1
subreport1
StudID 3
StudID 4
StudID 5
StudID 6
and so on

Here is the code
Code:
Private Sub Report_Open(Cancel As Integer)
    If Me.StudID > 2 and Me.StudID < 8 Then
        Me.subreport1.Visible = False
    Else
        Me.subreport1.Visible = True
    End If
End Sub

The problem with the above code is that it says that StudID has no value.

Then
Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    If Me.StudID > 2  and Me.StudID < 8 Then
        Me.subreport1.Visible = False
    Else
        Me.subreport1.Visible = True
    End If
End Sub

The problem with this is that the subreport1 appears after StudID is 1 (one) but i got nothing after StudID = 3.

Have i done anything wrong here?

Thank you in advance
 

Users who are viewing this thread

Back
Top Bottom