Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
A Placeholder is an attribute that specifies a short hint within a text box describing an input field’s required value. You might have already experienced such placeholders while filling out an online form. This great feature of the Placeholder on Text box or Combo box is also possible in MS Access forms where you can specify the short text description.
MS Access Form with Labels
MS Access Form with Placeholder
Using a placeholder in a text box offers several benefits, particularly in user interface design and user experience:
First of all, select your Text box or Combo box and put your descriptive instructions like below in the Format of the Property Sheet.
@;"Enter Supplier Name"
This will give you the placeholder but with an odd-looking text seems like filled already with some text. To get the professional-looking real placeholder, use Conditional Formatting.
Conditional Formatting Tule Manager
Conditional Formatting Rule
There is a way to specify Placeholder text color without using Conditional Formatting described above. Type this text in the Format section of the Text box or Combo box:
@;"Enter Supplier Name" [Red]
For example! if you want to use the Placeholder with a Date input text box where you also want to specify the Date format as “Shor Date”, the above method will allow you to apply only a single format, either the format of Placeholder or the Date format.
You can apply both formats using VBA coding. The first event code will apply in the Form Load and the other is from the Text box after the update:
Private Sub Form_Load()
If IsNull(Me.txtDate) = True Then
Me.txtDate.Format = "@;Enter Date[Red]"
Else
Me.txtDate.Format = "Short Date"
End If
End Sub
Private Sub txtDate_AfterUpdate()
If IsNull(Me.txtDate) = True Then
Me.txtDate.Format = "@;Enter Date[Red]"
Else
Me.txtDate.Format = "Short Date"
End If