ghost text or placeholder for textbox (1 Viewer)

guestbb

Registered User.
Local time
Yesterday, 17:19
Joined
Jul 14, 2015
Messages
44
I would like to put an example text in some textboxes so that when people type in them they now what or in what form to type.
I have seen this in forms online, kind of a ghost (shadowy) text is displayed when the textbox is empty, and when you click or start typing in the textbox it dissapears.
Does anyone know how to do this?
 

Ranman256

Well-known member
Local time
Yesterday, 20:19
Joined
Apr 9, 2015
Messages
4,339
you could make the text box:
the interior color ,white or transparent.
text color, light gray

on KEYDOWN event()
text color =vbBlack
 

guestbb

Registered User.
Local time
Yesterday, 17:19
Joined
Jul 14, 2015
Messages
44
ok. but how do i make it say in the textbox for example "First Name"?
And then when you click on the textbox or start writing it dissapears and i can type normally.
And also that it doesnt save the ghost text as something that is inserted in the textbox.
 

spikepl

Eledittingent Beliped
Local time
Today, 02:19
Joined
Nov 3, 2010
Messages
6,142
In the format property of the textbox, type this:

@;"Your ghost text to disappear"
 

guestbb

Registered User.
Local time
Yesterday, 17:19
Joined
Jul 14, 2015
Messages
44
Where is format property of the textbox exactlly? Where do I find it in the options?

EDIT: Found it. Thank you guys very much!!!
 

Ranman256

Well-known member
Local time
Yesterday, 20:19
Joined
Apr 9, 2015
Messages
4,339
property of the text box
default value:
 

DataBass

Registered User.
Local time
Yesterday, 17:19
Joined
Jun 6, 2018
Messages
68
Is there any way to combine this method with another format?

For example, is there a way to enter @;"Date" in the format property AND "short date" so that the field will still be a date field?

Or @;"Price" for the placeholder AND "Currency" as the actual format??

Thanks
 

mhorner

Registered User.
Local time
Yesterday, 20:19
Joined
May 24, 2018
Messages
50
You could also use VBA to do this so you can bind it to a control or event. I've used the code below to set the value of a text box, then when a user clicks inside the text box, it erased the default value. I think you can combine this with some VBA code to change your format too. For example:




Me!FieldToEdit.Format = "Medium Date"



FieldToEdit.Value = "Form #"



If FieldToEdit.Value = "Form #" Then

FieldToEdit.Value = ""

End If
 

Users who are viewing this thread

Top Bottom