outputting only certain fields

A

Anna

I have a table with info. for many different product
specification sheets, however some products have more
fields than others. Is there anyway that I can output in
my report only the fields that have a value in them, so
that those that are blank don't show up at all. When I do
it right now, the name of the field always shows up on my
report, even if it's blank. Thanks!
 
A

Allen Browne

No. You cannot have some fields on some rows and not on others.

If the label is the problem, you could replace it with a text box. This
example shows how to display the label "City" only if the field City has a
value.

Open the report in design view.
Right-click the label for City, and choose Change to | Text box.
Set the Control Source of the text box to:
=IIf(IsNull([City], Null, "City")
The quazi-label is now null when the field City is null.

You may also want to set the CanShrink propety of both the City text box and
its quazi-label text box to Yes, so that both boxes shrink when there is
nothing in them.
 
S

Sirocco

The answer is YES, you can.

The detail section that contains the following controls (arranged in a
column) will automatically shrink if any of these controls are null. The
section and each control in it must have Can Grow and Can Shrink = Yes. If
label for each control is "attached" it will grow or shrink with the
control.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.ControlName.Visible = Not IsNull(Me.ControlName)
Etc. for each control
End Sub

And I'm not even an MVP!
 
Top