Report > Display the title only

J

JY

I am new to Access. i am creating a report where i would like to have the
title to display only if there is data in the record field
ex:
John ext: 5555
Sara (should be blank)
 
J

John Spencer

There are a couple of ways to handle this. If the field is NULL (not a
zero-length string), you can use this technique.

Set the source of the text box control to
="ext: " + [NameOfExtensionField]

Delete the label control

Make sure the control has a different name than the field name or you will get
an error.

A second option is to use VBA code to show/hide the label.

In the section's format event you would need code like

Me.NameOfLabel.Visible = Len(Me.NameOfExtensionControl & "") <> 0

That should show or hide the label as appropriate.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
J

JY

Thank you that worked perfect

John Spencer said:
There are a couple of ways to handle this. If the field is NULL (not a
zero-length string), you can use this technique.

Set the source of the text box control to
="ext: " + [NameOfExtensionField]

Delete the label control

Make sure the control has a different name than the field name or you will get
an error.

A second option is to use VBA code to show/hide the label.

In the section's format event you would need code like

Me.NameOfLabel.Visible = Len(Me.NameOfExtensionControl & "") <> 0

That should show or hide the label as appropriate.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
I am new to Access. i am creating a report where i would like to have the
title to display only if there is data in the record field
ex:
John ext: 5555
Sara (should be blank)
 

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

Similar Threads


Top