Don't print field if null

tjs206

Registered User.
Local time
Today, 13:29
Joined
Sep 25, 2000
Messages
37
I have a report that has many fields. Of course, I don't want every field to print if it is null, the report would be long and ambiguous and nasty.

Is there a way to skip a field and have the next field (if not null) print in the same position?
 
Here's the code the set the property to not visible. Set it on the ONFormat event of the detail section.

If Me.Textbox=" " or IsNull (Me.Textbox]) Then
Me.LabelName.Visible = False

I did a post here to look for code that would do that for all empty fields. Look for answers.

So far it works for me if I set it for each field separately, but they don't move up over empty space even with the Grow/shrink property set.
 
Sorry
Discovered typo. Textbox should within [ ] or not.

If Me.Textbox=" " or IsNull (Me.Textbox) Then
Me.LabelName.Visible = False
 
Thanks, Rich.


That worked like a charm, it was perfect.
 
tjs206

I'm confused here. Did my post help your problem or did Rich's grow/shrink property work. Like to know because it does not work for me (it still leaves a space in between)
 
Actually what Rich gave me was the game winner.

Your code would work to hide the text box/label if all I wanted to do was hide those fields. But the thing was I needed to not only hide the null field but also to move the next field (if not null) right up under there.

Thanks to both of you.
 
Cool beans
Let me pick your brain now. Do you have a code that will hide all empty fields with one code or did you set a code for each one?
Thanks
Marcel
 
I set the canshrink property on every field to yes.

I didn't look into the VBA side since the answer that Rich gave worked. If that hadn't have worked, I would have turned to code.
 
Still confused
I have used the Grow/Shrink property before. All it does for me is to adjust the size (so there is no waisted space between the fields), but it never made the field invisible and / or move into teh space of the previous empty field.
Am I missing something here?????
 
If you set the canshrink property of a null field to yes then the textbox will have no size, which means if it takes up no room then the next non-null field will take it's place on the report. Try it, you will see what I mean.
 
I think I am a step furthrer.
The shrink property works but I have to make the label invisible. That's no problem anymore.
Need help with code that would make all labels invisible for all empty field in this form
Anyone out there with suggestions?

Thanks tjs206
 
Hi, ...think i'm after a similar problem to you guys.i'm trying to make a label invisible on a form, when the field is null. I don't need anything to move. I tried the above code and all i got was 'Can't find macro 'If Me'' Have i done something wrong here?
 
JustMaybe try an IIF in your control source for your textbox. Write something of this nature:

IIF (isnull[textboxname], [labelname].visible = false, 'Do Nothing)

textboxname is the textbox that you are checking for null. If the textbox is null, then the true part of the IIF will set the labelname (whatever your labelname is) to not visible. Otherwise if there is something in the textbox (not null) then 'Do Nothing.

Hope this helps.
 

Users who are viewing this thread

Back
Top Bottom