Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress Detail section when Null? 1

Status
Not open for further replies.

techsup07

Technical User
Jul 31, 2007
27
US
I was trying to search but it's not working so ...

I would like to be able to suppress the entire Detail section of my report if there is no data?

How would I do that and would the EventProcedure go in OnFormat or OnPrint?
 
You can set the visible property of the section.

[tt]Private Sub Report_NoData(Cancel As Integer)
Me.Section(acDetail).Visible = False
End Sub[/tt]
 
Hi there.
ok ... how do you do that?
the Visible is only Yes or nO?
 
Not in VBA it isn't, its true or false. Just paste the section above into your report's module. I am at a loss to know why you would wish to print a report with nothing in the detail section, that is, no data.
 
Sorry for the confusion, i need a code that will suppress the detail section ONLY when there isn't data.

Of course I want it to display the detail section when there is data.

Biggest reason for wanting to suppress the section when there's no data is because I have lines and the lines show when there is no data so you end up with extra lines and the report isn't clean because of that.

So I thought if I have something to suppress the when so these add'l lines when there's no data won't show.

By using what you have it suppresses it no matter what.
 
You seem to wish to supress detail lines, not the detail section of the report. The usual way to avoid printing lines where data is missing is a query.
 
that doesn't make sense to me as I want data as the current statement is of a Left-outer-join.

I want everything in my BOM table and then all the data twhere it matches the BOM table of the components.

So some may not have component items.
Then the report prints the component items data of the detail section when there isn't any data afterall.


did that make sense?

As noted, I want to only suppress the section because there are lines in the section that show when there are no related data, hence why I need to have the Detail section suppressed ONLY when there is no data.
 
How are ya techsup07 . . .

I think I understand. Using a single textbox to incite the idea, in the [blue]On Format[/blue] event of the [blue]detail section[/blue], copy/paste the following:
Code:
[blue]   If IsNull(Me![purple][b][i]TextboxName[/i][/b][/purple]) Then
      Me.Detail.Visible = False
   Else
      Me.Detail.Visible = True
   End If[/blue]

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
In my version of Access I cannot seem to make the detail selectively display. I think what you need, techsup07, it to base your report on the BOM and add a subreport for the component items. This is the standard way of creating such a report. the subreport will automatically hide itself if there is no data. I hope this is clearer, I found your last post more informative.
 
Hi Aceman1,
i received a compile error on the [ME!2ndLevel]

2ndLevel is the textboxname of in the Detail section.


 
techsup07 . . .

Use parentheses [blue]()[/blue] not brackets [blue][][/blue] . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
sorry, i do have the ().

turns out it did not like 2nd, so i just change the textboxname to secondlevel instead of 2ndlevel and it works great!

thank you very very much!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top