Conditional Show/Hide Records

G

Guest

I have a report that lists loan officers and their loan sales for the
previous month. Some loan officers supervise others, and therefore the report
is grouped on the Supervisor field.

In the detail section, how do I hide an entire record if the loan officer's
name is the same as the supervisor's name? Here is the code I tried to use in
the detail section, but it only hides the field containing the loan
officer's name; I need to hide the entire record. BUT, I still need the data
to be in the report so that the loan sales numbers can be used on
calculations on the report.

If Loan_Officer = Supervisor Then
Me.Loan_Officer.Visible = False
Else
Me.Loan_Officer.Visible = True
End If

Any help would be greatly appreciated!

GwenH
 
G

Guest

Instead of writing extra code, you can a filer to your report Record Source,
such as

Select * From TableName Where Loan_Officer <> Supervisor
====================================

To follw your idea, which I don't recomand, yu need to specify for each
field in the detail section

Me.Loan_Officer.Visible = (Loan_Officer <> Supervisor)
Me.Supervisor.Visible = (Loan_Officer <> Supervisor)
Me.FieldName.Visible = (Loan_Officer <> Supervisor)
Me.FieldName2.Visible = (Loan_Officer <> Supervisor)
Me.FieldName3.Visible = (Loan_Officer <> Supervisor)

etc
 
J

John Spencer

I seem to recall that you can set the entire section to visible.not visible in
the format event of the section

me.Section(acDetail).Visible = ([Loan_Officer] <> [Supervisor])

Test that, I wrote it off the top of my head and the constant acDetail may be
incorrect. Can't check that on this computer.
 
G

Guest

Excelent, never stop to learn new things
Thanks John


John Spencer said:
I seem to recall that you can set the entire section to visible.not visible in
the format event of the section

me.Section(acDetail).Visible = ([Loan_Officer] <> [Supervisor])

Test that, I wrote it off the top of my head and the constant acDetail may be
incorrect. Can't check that on this computer.
 
G

Guest

I'm sorry, I didn't explain myself clearly enough. This is the structure of
my report:

Group Header: Alene (Supervisor) - No other fields on this line
-------------------------------------------------------------------------
Detail section:
John
Don
Alene
Alene Totals

What I want to do is hide Alene's first line in the detail section. I don't
want to hide the whole detail section, nor do I want to filter Alene's data
out because it is used in calculations on the report. I just want to hide her
line, without leaving a blank line in the detail section where her line would
have been (in other words, a white row all the way across the report, in the
middle of the detail section).

Thanks again,
GwenH
 
J

John Spencer

So, in the detail section's format event, try the code that was posted
earlier. Did that fail? If so, what was the error? Or how did it fail?

Me.Section(acDetail).Visible = ([Loan_Officer] <> [Supervisor])

That should show/hide individual detail lines.
 
G

Guest

Sorry, I thought you were telling me how to hide the entire section. The
solution you suggested worked; thank you.

John Spencer said:
So, in the detail section's format event, try the code that was posted
earlier. Did that fail? If so, what was the error? Or how did it fail?

Me.Section(acDetail).Visible = ([Loan_Officer] <> [Supervisor])

That should show/hide individual detail lines.

Gwen H said:
I'm sorry, I didn't explain myself clearly enough. This is the structure
of
my report:

Group Header: Alene (Supervisor) - No other fields on this line
-------------------------------------------------------------------------
Detail section:
John
Don
Alene
Alene Totals

What I want to do is hide Alene's first line in the detail section. I
don't
want to hide the whole detail section, nor do I want to filter Alene's
data
out because it is used in calculations on the report. I just want to hide
her
line, without leaving a blank line in the detail section where her line
would
have been (in other words, a white row all the way across the report, in
the
middle of the detail section).

Thanks again,
GwenH
 

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