Hide text box and lables in reports with no data

B

bohon79

I have a report built that has mulitple data fields in it that are ented from
a form. Some of the fields on the form do not get inputted in but they still
show up on the report. I have tried different codes and formulas on this
webite. What I am trying to do is if I do not imput the mos in than the text
box then the word current (label) does not appear. Here is one code I have
tried =IIf([MOS]>0,"Current",""). It works half way. When I do not enter a
MOS in the MOS and word go away but when I put a MOS in it gives me an error.

any help please.
 
T

tina

looks like you're using a textbox for the "label", rather than a label
attached to a bound control. if that's the case, suggest you create a new
report (so as not to have to change the work you already put into the
original report). i'm assuming that the data on the *form* is saved to an
underlying table, so bind the report to that table. to test the following
solution, just add all the fields to the report's Design view - don't worry
about making it pretty until you see if it works.

enter the text you want to see for each control's label, directly into the
label's Caption property. make sure that each control is bound to a field in
the report's underlying table.

add the following code to the Detail section's Print event procedure, as

Me!MOS.Visible = Not IsNull(Me!MOS)

if the MOS field in a record has no value (is null), then the Visible
property of the control with the same name is set to False, otherwise the
Visible property is True.

add a line of code for each control that you want to show/hide based on its'
contents.

hth
 

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