Field only shows if data exists (Report)

E

Eric

I have a query that pulls the records that I need, yet on the report I want
to show the field lables and data only if the field is not null. The record
may have some fields that are populated and some that are not. The report
shows all fields from the record, null or not.

Any ideas?

Thanks
 
A

Allen Browne

I take it you have a label attached to a text box, and if the text box is
null for that record, you want to suppress the label.

Here's a codeless way to do that, using a text box named City as an example:
1. In report design view, right-click the attached label, and choose:
Change To | Text Box.
Access changes it into a text box.

2. Set the Control Source property of the new text box to:
=IIf([City] Is Null, Null, "City:")

Now if the City field is null, so is it's "label"; but if the City has some
text, then this text-box-acting-as-a-label reads City:

As a bonus, you can set the new text box's CanShrink propety to Yes.
 
E

Eric

Thanks Allen, that works great!

Cheers
--
Eric the Rookie


Allen Browne said:
I take it you have a label attached to a text box, and if the text box is
null for that record, you want to suppress the label.

Here's a codeless way to do that, using a text box named City as an example:
1. In report design view, right-click the attached label, and choose:
Change To | Text Box.
Access changes it into a text box.

2. Set the Control Source property of the new text box to:
=IIf([City] Is Null, Null, "City:")

Now if the City field is null, so is it's "label"; but if the City has some
text, then this text-box-acting-as-a-label reads City:

As a bonus, you can set the new text box's CanShrink propety to Yes.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Eric said:
I have a query that pulls the records that I need, yet on the report I want
to show the field lables and data only if the field is not null. The
record
may have some fields that are populated and some that are not. The report
shows all fields from the record, null or not.

Any ideas?

Thanks
 

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