Hide Details When there is no Info?

C

Caryn

I have a table with client names and another table with the family members of
the client. Those are connected via a relationship. If I create a report
using the wizard, the clients that don't have family members still have a
blank detail line which has only labels showing. How do I make this line only
appear when there is data in the the family members?
 
J

Jeff Boyce

Caryn

Open the report in design view.

Select the textboxes in your 'detail' section.

Open the Properties window and set CanGrow (and CanShrink) to "Yes".

If your query is set up properly, so that Nulls are returned when there is
nothing in the familymember table, your report will squeeze-down the detail
section textboxes. You might also need/want to set CanGrown/Shrink for the
detail section itself (I'm not looking at Access right now, so I'm not
certain this is available/necessary).

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
C

Caryn

It worked, but only if I delete the labels in the detail section. Is there a
way to keep the labels there, but only when there is data in the section?
 
M

Marshall Barton

Caryn said:
It worked, but only if I delete the labels in the detail section. Is there a
way to keep the labels there, but only when there is data in the section?


Add a kine of code to the group header's Print event
procedure to hide the detail section when a field is Null:

Me.Section(0).Visible = Not IsNull(somefield)

Nake sure you choose a field that is never Null in the child
table.
 
J

Jeff Boyce

Caryn

This doesn't happen if the labels are 'attached' to the text boxes. If the
labels are unattached, attach them!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 

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