Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Placeholder on Text box or Combo box in MS Access Forms

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 Labels

MS Access Form with Placeholder

MS Access Form with Placeholder

Benefits of Using Placeholder on Text box

Using a placeholder in a text box offers several benefits, particularly in user interface design and user experience:

  • Placeholders can offer users examples or instructions regarding the expected input.
  • Placeholders help in clarifying the required format, data type, or content, making it easier for users to understand what to enter in the text box.
  • By offering hints within the text box itself, placeholders can reduce user frustration and minimize the likelihood of input errors.
  • Placeholders can save screen space by eliminating the need for additional labels or instructions outside the text box.
  • Properly designed placeholders can enhance the visual appeal of a form or interface by providing a clean, uncluttered look.
MS Access Placeholder with Textbox

Method to Apply Placeholder on Text box

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 Tule Manager

Conditional Formatting Rule

Conditional Formatting Rule

Specify Separate Colors for Placeholder Text

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]

How to Apply Other Formats with Placeholders Using VBA Coding

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

Leave a Reply

Your email address will not be published. Required fields are marked *