View Full Version : Do Not Show Text Box if Empty


depawl
08-08-2007, 06:11 PM
I have a report with a Text Box based on a memo field in a form. Data is not always entered into this field. If data is entered I need it to show on the report. If not data is entered, I would like to have the field not show on the report, including the label. Is there a way to do this?
Thanks,

mattkorguk
08-09-2007, 01:37 AM
I'm sure you could just do a "If isnull [fieldname].value then [fieldname].visible = false and [labelfieldname].visible = false. Put this under the OnOpen Event of the report.
Or something similar.

mperet
08-24-2007, 09:28 AM
I'm sure you could just do a "If isnull [fieldname].value then [fieldname].visible = false and [labelfieldname].visible = false. Put this under the OnOpen Event of the report.
Or something similar.

I've been trying to do a similar thing. IsNull only works on numerical values, not text.

Back to my friend, the 'search forums' function...

pbaldy
08-24-2007, 09:32 AM
Actually it will work on any Null field, text or numeric, but text fields could contain a zero length string, which will look the same. Try

If Nz(FieldName, "") = "" Then

WayneRyan
08-24-2007, 09:37 AM
d,

Also, the OnOpen event is probably not the event you want to use.

Use the OnFormat event of your Detail section ... and make sure to
set the CanGrow/Shrink property of the textbox to Yes to prevent
having a potentially large empty space on your report.

Wayne

mperet
08-24-2007, 10:12 AM
Actually it will work on any Null field, text or numeric, but text fields could contain a zero length string, which will look the same. Try

If Nz(FieldName, "") = "" Then

Sorry to hijack this thread...

I'm getting the above to work SORT OF...

I'm trying to set fields to visible or not depending on whether the text field contains information. I'm using multiple forms. the problem is that ALL of the fields are being set as invisible whether the related text field contains information or not. I'm getting really puzzled and frustrated. I've tried adding and else if statement with no results.

TIA,
Mary