Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

The text box is the standard control in Access used for viewing and editing data on forms and reports. Many different types of data can be displayed in text boxes, and you can also use them to perform calculations. This article explains how to create and use a text box and also explains some important text box properties.

What do you want to do?

Add a bound text box

A bound text box displays data from a field in a table or query. On a form, you can use a text box that is bound to an updatable record source to enter or edit data in a field. The changes that you make in the text box will be reflected in the underlying table.

A quick way to create a bound text box is by dragging a field from the Field List pane onto your form or report. Access automatically creates a text box for fields of the following data types:

  • Short Text

  • Long Text

  • Number

  • Date/Time

  • Currency

  • Hyperlink

  • Calculated

Note: Beginning in Access 2013, Text data types have been renamed to Short Text and Memo data types have been renamed to Long Text.

Dragging fields of other data types creates different types of controls. For example, if you drag a Yes/No field from the Field List pane to a form or report, Access creates a check box. If you drag an OLE Object field to a form or report, Access creates a bound object frame, and if you drag an attachment field to a form or report, Access creates an attachment control.

Add a bound text box to a form or report by dragging a field from the Field List pane

  1. Open the form or report in Layout view or Design view by right-clicking the form or report in the Navigation Pane, and then clicking the view you want.

  2. On the Design tab, in the Tools group, click Add Existing Fields Button image.

  3. In the Field List pane, expand the table containing the field that you want to be bound to your text box.

  4. Drag the field from the Field List pane to the report or form.

    For more information about working with the Field List pane, see the article Add a field to a form or report.

You can also add a bound text box to a form or report by first adding an unbound text box, and then setting the Control Source property of the text box to the field you want to bind it to.

Add an unbound text box

An unbound text box is not connected to a field in a table or query. You can use an unbound text box to display the results of a calculation or to accept input that you don't want to store directly in a table. It is easiest to add an unbound text box in Design view.

  1. Open the form or report in Design view by right-clicking the form or report in the Navigation Pane, and then clicking Design View.

  2. On the Design tab, in the Controls group, click Text Box.

  3. Position the pointer where you want the text box to be placed on the form or report, and then click to insert the text box.

    Note: Access also places a label to the left of the text box, so leave some room to the left of the pointer for the label. You can reposition the label and the text box later. You can also delete the label by clicking it and then pressing DELETE.

Another way to create an unbound text box is by first creating a bound text box by dragging a field from the Field List pane onto the form or report, and then deleting the value in its Control Source property. If you do this in Design view, the text box will display "Unbound" instead of the field name. In Layout view, the text box will no longer display data — in fact, it will be blank.

Add a calculated text box

  1. Open the form or report in Design view by right-clicking the form or report in the Navigation Pane, and then clicking Design View.

  2. On the Design tab, in the Controls group, click Text Box.

  3. Position the pointer where you want the text box to be placed on the form or report, and then click to insert the text box.

  4. Do one of the following:

    Place the cursor in the text box, and then type an expression that calculates a total.

    Select the text box, press F4 to display the property sheet, and type the expression in the Control Source property box. To use the Expression Builder to create the expression, click Builder buttonnext to the Control Source property box.

  5. Save the form or report and then switch to Form view or Report view to check the results.

For more information about creating expressions, see the article Learn to build an expression.

NOTES:

  • If you need more room to type an expression in the ControlSource property box, press SHIFT+F2 to open the Zoom box.

  • If your form or report is based on a query, you might want to put the expression in the query instead of in a calculated control. Doing this can improve performance, and if you are going to calculate totals for groups of records, it is easier to use the name of a calculated field in an aggregate function.

Understand text box properties

Regardless of how you create a text box, certain properties need to be set so that the text box works and appears the way that you want. The following list shows a few of the more important and commonly used text box properties:

  • Name    You should give your text box a short, meaningful name so that you can easily tell what data it contains. This makes it easy to refer to the text box in expressions that you might use in other text boxes. Some database developers prefer to add a prefix, such as txt, to text box names so that they can easily distinguish text boxes from other types of controls—for example, txtFirstName or txtAddress.

    When you create a bound text box by dragging a field from the Field List pane, Access uses the field name as the text box name. This usually works well, but if you plan to edit the Control Source property and create an expression, it is a good idea to first change the text box name so that it is different from the field name. Otherwise, Access might be unable to determine whether you are referring to the text box or to the field in the table. For example, suppose you have a report containing a text box named First Name, which is bound to a table field named First Name. If you want to trim any spaces that might precede the value in the First Name field, you might set the Control Source property of the text box to:

    =Trim([First Name])

    However, this results in #Error appearing in the text box, because Access cannot determine whether the expression is referring to the field or to the text box. To fix this problem, rename the text boxes so that they have unique names.

  • Control Source    This property determines whether the text box is bound, unbound, or calculated.

    • If the value in the Control Source property box is the name of a field in a table, the text box is bound to that field.

    • If the value in Control Source is blank, the text box is unbound.

    • If the value in Control Source is an expression, the text box is a calculated text box.

  • Text Format    If the text box is bound to a Long Text field, you can set the value in the Text Format property box to Rich Text. Doing this allows you to apply multiple formatting styles to the text contained in the text box. For example, you can apply bold formatting to one word and underlining to another.

  • Can Grow    This property is particularly helpful on reports for text boxes that are bound to Short Text or Long Text fields. The default setting is No. If there is too much text to display in the text box, the text is truncated (cut off). However, if you set the value of the Can Grow property box to Yes, the text box automatically adjusts its vertical size to print or preview all the data that it contains.

Top of Page

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×