Formatting a Report

  • Thread starter Thread starter AnnMarie
  • Start date Start date
A

AnnMarie

I need a report that lists by office - all Employee Names
and the Titles of any Classes that they've taken. I have
the report grouped on Office and Last Name. If the
Employee didn't take any classes, I want to hide the part
of the Last Name Header, and display a Label that
states: "This employee did not take any classes." My
problem is: which Event do I use to type in the code for
hiding the labels in the Last Name Header and displaying
the new Label?

I've tried the OnFormat and OnPrint Events for the Detail
Section, but that didn't work. The Detail Section
contains ClassTitle, so I specified:
If Me.ClassTitle = Null then
Me.ClassTitle_Label.Visible = False
{etc...}
End If

Can anyone please help? I am using Access 97.

Thanks,
Ann
 
AnnMarie said:
I need a report that lists by office - all Employee Names
and the Titles of any Classes that they've taken. I have
the report grouped on Office and Last Name. If the
Employee didn't take any classes, I want to hide the part
of the Last Name Header, and display a Label that
states: "This employee did not take any classes." My
problem is: which Event do I use to type in the code for
hiding the labels in the Last Name Header and displaying
the new Label?

I've tried the OnFormat and OnPrint Events for the Detail
Section, but that didn't work. The Detail Section
contains ClassTitle, so I specified:
If Me.ClassTitle = Null then
Me.ClassTitle_Label.Visible = False
{etc...}
End If


I think you can do what you want if the report's record
source query has at least one record for every employee.
This can be done by using a Left Join from the employee
table to the classes tables.
 
Thanks for the response, Marshall! My query (and report)
does list everyone. What I need to do is hide the header
info for those who haven't taken any classes. I'm not
sure on what Event I need to program my code.
 
OK, that's good. I think the code should be in the Format
event of the name header section.

Dim bolAnyClass As Boolean
bolAnyClass = IsNull(Me.ClassTitle)
Me.ClassTitle_Label.Visible = Not bolAnyClass
Me.NoClasses_Label.Visible = bolAnyClass

You will still get a blank area for the detail section with
the Null data values. If you don't want that then add:

Me.Sction(0).Visible = Not bolAnyClass

to the abovelines.
 
Back
Top