textbox label

A

alavaz17

Can I set up my text boxes so that the label is in the background of the text
box (like in design view where you see the control source of the text box in
its field) until data is entered into the text box? client is looking to use
this as a data entry validation.
 
S

Steve Schapel

Alavaz,

The only way I can think of to do this with the attached label would
involve doing some coding to manipulate the properties of the controls,
let's say on the form's Current event.

Another approach that might be easier is to use Conditional Formatting.
Put an unbound textbox "behind" each of the data controls, and set
them to show the text required. The data controls themselves will need
to be Transparent back style. Then you can apply Conditional Formatting
to the unbound textbox to set its forecolor to the same as the backcolor
(so the text doesn't show) if there is an entry in the data control.
Hope that makes sense.
 
A

alavaz17

I am sorry but I cannot make the conditional formatting work. It applies the
color changes regardless of the condition. But my condition could be
invalid- would my expression be: form.formname.textname Is not Null? and
would I apply this to both boxes? thanks for your help. I will keep working
 
A

alavaz17

Hello again. First, thank you for your help, I was able to make that work.
However, I have realized that this wasn't exactly what was needed. Rather, I
need to show the unbound textboxes with the field names as a new record is
opened, to identify what should be entered where. But when the record is
saved, I need the unbound textboxes to disappear, so that when one scrolls
through the records, they only see the data entry. Hope this makes sense.
Thanks again for your help!

Steve Schapel said:
Alavaz

The condition would be like this...
[NameOfYourField] Is Not Null

--
Steve Schapel, Microsoft Access MVP
I am sorry but I cannot make the conditional formatting work. It applies the
color changes regardless of the condition. But my condition could be
invalid- would my expression be: form.formname.textname Is not Null? and
would I apply this to both boxes? thanks for your help. I will keep working
on this.
alavaz
 
S

Steve Schapel

Alavaz,

Yes, that is exactly what I thought we were doing. This is how I
imagine it... you have your bound textbox, sitting over the top of the
unbound textbox. The Contol Source of the unbound textbox is something
like this...
="NameOfBoundTextbox"
.... and the unbound textbox has Conditional Formatting applied such that
if the bound textbox is not null (i.e. if there is data entered in the
bound textbox), the text displayed in the unbound textbox will not be
seen because the color is changed. To me, this will mean that you will
see the text of the unbound textbox if there is nothing entered into its
corresponding bound textbox yet. So what are we missing?
 
A

alavaz17

What if a field is left blank b/c there is no data for that field? For ex, a
client # that some of our clients use to reference their accts...but some
don't, and I don't what to show "client no" in the entered record.
 
S

Steve Schapel

Alavaz,

Ok, I see what you mean. Well, to follow the same theme, I guess you
will really have to try to create or identify some field that will
always have data in a saved record. You might set up a field
specifically for this purpose, if one doesn't exist already. For
example you could have a Yes/No data type field, hidden probably, with
code on the form's Before Update event like this...
My.YourYesNoField = -1
.... and then the Cinditional Formatting expression that we have been
discussing might be something like this...
[NameOfYourField] Is Not Null Or [YourYesNoField] = -1
 
Top