PLZ hlp fix my broken report labels

T

totoro

I used the report wizard in Access 2002 to create a report for a table with
about 58 fields, but only about half that many usually have data.
so I converted the labels to text boxes, and set them all to CAN SHRINK, and
set the page to the same.
When I convert the labels, they display UNBOUND, and I lose it here:
I cannot control what's displayed in the label when I run the report,
If I select Control Source to the Text box name from the pull down, I get
that data (soi the record is labeled with the same text as the label itself,
or If I add my own label, I get prompted when I run the report, and if I
leave it as UNBOUND I have no label at all.

I know I am missing something small but I can't figure it out.

I appreciate any suggestions. Thanks.
 
N

NetworkTrade

you go back and forth between the term 'label' and 'textbox' and 'field' in a
very confusing way;

a label is passive; only manually typed in words - it has no record source;
they are, by definition unbound so to speak...but that is a bit of a misnomer
because they are never really bound in the sense that never is data inserted
from a table/query... one cannot convert a label to a textbox.

a textbox is either bound to the record source, or can be unbound - the
unbound textbox is used to display a calculated value that does not need to
be stored in a table....

the wizard will add a textbox with a corresponding label; since most people
want the label next to the textbox; in a sense this label is 'bound' to this
textbox but that is an incorrect use of the word bound and the label can be
deleted so one only has the textbox - which is common if the type of data is
obvious there is no need for a label to describe it....
 
J

John Spencer

In the textbox you can use
="This is my label"

However, then there is a value in the control and it won't shrink.

One technique is to use the current controls which you will have to
rename to avoid getting an error.

Say the current control is named LastName and is bound to the field
LastName. Change to control's name to txtLastName and its source to
="Last Name: " + [LastName]

You will need to do that for each control you want to shrink. The trick
here is that if LastName is Null then the plus operator will propagate
the null and make the entire expression null.

You could also use VBA code in the format event of the section to
show/hide the label control or set the value of the textbox you are
using as a label based on the value in the associated control. That
would look something like

Me.LabelLastName.Visible = Len(Me.LastName & "") > 0
Me.LabelFirstName.Visible = Len(Me.FirstName & "") > 0
and so on, so forth.

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 

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