Report > Display the title only

  • Thread starter Thread starter JY
  • Start date Start date
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)
 
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
 
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)
 
Back
Top