Default Text in Textbox??

gmatriix

Registered User.
Local time
Today, 10:12
Joined
Mar 19, 2007
Messages
365
Hello all,

I think I have a simple question. I have a regular form with name,address,phone and so forth. I am trying to display the name in the textbox but when you click or tab to the textbox the default text goes away. However if the field is blank then it will display default text...

Is this possible??

Thanks
 
Something like this maybe? It will fill the empty box with the default text as the record is loaded but it will disappear when the box gets focus.

Use the On Current event procedure of the form.
Code:
 If IsNull(Me![thetextbox]) OR Me![thetextbox]) = "" Then: Me![thetextbox] = "your default text"

In the On Got Focus event of the control
Code:
If Me![thetextbox] = "your default text" Then: Me![thetextbox] = ""

To make the default reappear when the focus is lost call the On Current procedure with the On Lost Focus event procedure of the textbox.

If you want the default text not to be recorded in the table then call the Got Focus procedure in the Before Update event procedure of the form.

You would probably set a constant for the "your default text" and in turn set that constant from a record in a table that in turn is set from a form.

Hope this makes sense and is what you are looking for.
 
Thank you very much I will try it...

Thanks again!
 

Users who are viewing this thread

Back
Top Bottom