If all Sub Reports are null dont show Parent

G

Guest

I have a Parent Report that contains individual information such as name,
director, manager, dept. It also has 6 Sub Reports in it linked by employee
ID, These different Sub Reports are for Phones, Computers, Pages and such. I
have it set so if the sub report is null it does not show but the other sub
reports will show their data.

Now what I would like to do is IF all of the Sub Reports are null don’t show
that employee on the parent report.

If possible and someone could point me in the right direction it would be
appreciated.

TIA
 
M

Marshall Barton

Steve_A said:
I have a Parent Report that contains individual information such as name,
director, manager, dept. It also has 6 Sub Reports in it linked by employee
ID, These different Sub Reports are for Phones, Computers, Pages and such. I
have it set so if the sub report is null it does not show but the other sub
reports will show their data.

Now what I would like to do is IF all of the Sub Reports are null don’t show
that employee on the parent report.


You can add some code to the detail section's Format event
procedure:

Cancel = Not (Me.subr1.Report.HasData _
Or Me.subr2.Report.HasData _
Or Me.subr3.Report.HasData _
Or Me.subr4.Report.HasData _
Or Me.subr5.Report.HasData _
Or Me.subr6.Report.HasData)
 
G

Guest

Thanks Marshall

I tried it two ways first time I put this in the event procedure class
module and get a Compile error: Syntax error
--------------------------------------
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Cancel = Not (Me.SubBasicVoiceRpt.Report.HasData_
or
Me.SubCallingCardRpt.Report.HasData_
or
Me.SubCellPhonesRpt.Report.HasData_
or
Me.SubMDSRpt.Report.HasData_
or
Me.SubPagerRpt.Report.HasData_
or
Me.SubRemoteRpt.Report.HasData)

End Sub
-----------------------------------------------------------------

and then I put this in the On Format line as a single string

Cancel = Not (Me.SubBasicVoiceRpt.Report.HasData or
Me.SubCallingCardRpt.Report.HasData or Me.SubCellPhonesRpt.Report.HasData or
Me.SubMDSRpt.Report.HasData or Me.SubPagerRpt.Report.HasData or
Me.SubRemoteRpt.Report.HasData)

and got this message
Microsoft Access can't find the macro 'Cancel=Not (Me.'

so did I missunderstand that the _ means continued on next line?
or
does Access 97 not understand the Me.xxxx statment?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
K

Ken Snell \(MVP\)

Insert a blank space just to the left of the underscore character at the end
of each line, and don't leave the 'or' code by itself on a line:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Cancel = Not (Me.SubBasicVoiceRpt.Report.HasData _
or Me.SubCallingCardRpt.Report.HasData _
or Me.SubCellPhonesRpt.Report.HasData _
or Me.SubMDSRpt.Report.HasData _
or Me.SubPagerRpt.Report.HasData _
or Me.SubRemoteRpt.Report.HasData)

End Sub
 
G

Guest

Thanks Ken, amazing what a few spaces in the right spots will do. Makes for
a much cleaner report.

You and Marshall rock
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top