Why use text boxes as labels?

  • Thread starter Thread starter Stapes
  • Start date Start date
S

Stapes

Hi

The guy I replaced in my current position used text boxes throughout
instead of labels on his forms. This makes it difficult when making
amendments, as all the field names in Design View just say Unbound. I
have been replacing them with Labels as I go, but am I missing
something?
Is there any good reason for doing this?

Stapes
 
I don't see why it should make things any more difficult, but then I always
rename all of my controls, giving them meaningful names.

I can't think of any strong reason why to use text boxes instead of labels,
though.
 
There's a couple of reasons why they might have done this.

a) If this is on Access 2003, and the controls are on a tab control:
http://allenbrowne.com/ser-46.html
This issue was solved in SP3 for Office 2003.

b) If you need an expression, so the "caption" changes under different
conditions.

c) On a report if you want the controls to shrink.

d) 'coz the guy didn't know the difference between a text box and a label?
:o)
 
Stapes,
Labels should be labels, and text controls should be text controls.
I would imagine that because all those "caption" text controls are
actually calculated fields, they would add to the overhead on a form.
Probably not really noticeable though, unless there were a great many of
them. It's not kosher, but also not a serious problem.

But, your statement...is very odd... A text control used as a label would have something like
this in the ControlSource...
= "This is the displayed text"
In design view that control would show...
= "This is the displayed text"
not "Unbound." You should still be able to see what the control will
display when the form is run.

*** You must be sure that he has not coded some of these controls to change
their text during data entry on the form. In that case, converting those
Text controls to Labels would cause the code to fail.

Please show a couple of examples of the text controls... we may be
missing something here.
And make sure that no Macros, or any VBCode address these values at
runtime.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Stapes,
Labels should be labels, and text controls should be text
controls. I would imagine that because all those "caption"
text controls are
actually calculated fields, they would add to the overhead on a
form. Probably not really noticeable though, unless there were a
great many of them. It's not kosher, but also not a serious
problem.

But, your statement...
is very odd... A text control used as a label would have
something like this in the ControlSource...
= "This is the displayed text"
In design view that control would show...
= "This is the displayed text"
not "Unbound." You should still be able to see what the control
will display when the form is run.

*** You must be sure that he has not coded some of these controls
to change
their text during data entry on the form. In that case,
converting those Text controls to Labels would cause the code to
fail.

Please show a couple of examples of the text controls... we
may be
missing something here.
And make sure that no Macros, or any VBCode address these
values at
runtime.

If the original coder set the values via code, and was ignorant of
the fact that one needs to specify the .caption property in code to
change a label's text, as opposed to a textbox not needing a
property specified, yhat coder may have used the textboxes instead
of the labels.

me.lbl01 = "This is some text" fails
me.txtl01 = "This is some text" works
me.lbl01.caption = "This is some text" works

I've encountered several applications where the coders used
textboxes simply because they could not find how to change a label.
 
Bob,
Good points. I never thought of leaving all text controls
blank, and
coding to set values on form open...

It's about the only way to have a multi-lingual application, that
you can change languages at any time.. You'd set up a table with the
relevant form name textboxId, language ID and label text. Code in
the form load event retrieves the relevant strings and populates the
form text.
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in
your life."

My boss claims I haven't worked a day in the 30 years I've been
with the company. Based on the above, he's right.

Q
Bob Quintal said:
If the original coder set the values via code, and was ignorant
of the fact that one needs to specify the .caption property in
code to change a label's text, as opposed to a textbox not
needing a property specified, yhat coder may have used the
textboxes instead of the labels.

me.lbl01 = "This is some text" fails
me.txtl01 = "This is some text" works
me.lbl01.caption = "This is some text" works

I've encountered several applications where the coders used
textboxes simply because they could not find how to change a
label.
 
Bob,
Good point about the language dependency. Here in New Hampshire it would
be...
PahtNumbah = ACW1251 :-D
--
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

Bob Quintal said:
Bob,
Good points. I never thought of leaving all text controls
blank, and
coding to set values on form open...

It's about the only way to have a multi-lingual application, that
you can change languages at any time.. You'd set up a table with the
relevant form name textboxId, language ID and label text. Code in
the form load event retrieves the relevant strings and populates the
form text.
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in
your life."

My boss claims I haven't worked a day in the 30 years I've been
with the company. Based on the above, he's right.

Q
 

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

Back
Top