How to make default value disappear when clicked

vent

Registered User.
Local time
Today, 17:51
Joined
May 5, 2017
Messages
160
Hi all

I have a form with various fields and a number of default values (e.g. 'N/A', '000-000-000', etc) How do I make it where once clicked in the box, those defaults automatically disappear rather than highlighting them and deleting?
 
then dont use Default value.


Montoya:"You keep using that word. I do not think it means what you think it means."
 
Sre u un continuous form if so look for queing banner on this forum
 
No, its Queing banner
 
Sorry but I can't find it. Can you direct me?
 
rather than using a default value, use the format property for the control and leave the default value empty.

your examples are all strings so for a string you could use

@;[Red]"N/A"

for a number with a null value

0;0;0;[Red]"enter a value greater than 1"

instead of red, you can use a number of alternative colours (the default is black) such as green, blue, yellow
 
My mistake, cuing banner is for Unbound controls onlyonly.
 
rather than using a default value, use the format property for the control and leave the default value empty.

your examples are all strings so for a string you could use

@;[Red]"N/A"

for a number with a null value

0;0;0;[Red]"enter a value greater than 1"

instead of red, you can use a number of alternative colours (the default is black) such as green, blue, yellow

Hi

So I went into the field Phone Number's format property and did this:
@;[Red]"000-000-0000"
I like how it goes away but when I go into the table where I entered the record, the field phone number is blank
 
what else to you expect? - include a default value you need to change or have it blank if you don't enter anything?

only other thing I can think you can try is to have a bit of code in the control enter event to delete the contents -

e.g. me.txtControl=""

or have you looked at using the input mask property
 
This simple procedure selects the contents of the textbox when it is clicked on so that any typing will overwrite what is already in it.

Code:
Private Sub textboxname_Click()
    With Me.textboxname
        .SelStart = 0
        .SelLength = Len(.Text)
    End With
End Sub
It could easily be modified to only select if the value was equal to the default.
 
Thanks guys, my solution was having a default value and setting the onclick property to an event procedure followed exactly what CJ London said and did me.txtControl="".

Thanks!
 
Yes that we'll do on new record, how about you are only browsing and you click the field.
 
Vent,
Something important to remember regarding default values, they should only be used if there is a good reason for it.

NULL is as good a value as any when information is needed. Defaulting a field to '000-000-000' is not only not useful (doesn't really mean anything) but will fill your file with useless information. Better to leave it null rather than putting useless data in.

Defaulting to the most common value is useful, so long as end users understand why. If 90%+ of all transactions are sales, defaulting transaction type to "Sale" makes sense. Only for those cases where it needs to be otherwise do you change it.
 
Vent,
Something important to remember regarding default values, they should only be used if there is a good reason for it.

NULL is as good a value as any when information is needed. Defaulting a field to '000-000-000' is not only not useful (doesn't really mean anything) but will fill your file with useless information. Better to leave it null rather than putting useless data in.

Defaulting to the most common value is useful, so long as end users understand why. If 90%+ of all transactions are sales, defaulting transaction type to "Sale" makes sense. Only for those cases where it needs to be otherwise do you change it.

Thanks for your input Mark. I will rethink this whole approach before I present this project later this month. Thank you.
 

Users who are viewing this thread

Back
Top Bottom