In Microsoft Access databases, you can use the Yes/No data type to store a Boolean value, such as True or False, On or Off, Yes or No, and any field that contains only one of two values. This data type often maps to a Check Box control on a form or report.
In this article
Add a Yes/No field in Datasheet view
You can add a Yes/No field to a new or existing table in Datasheet View.
Add to an existing table
-
Open the table in Datasheet View.
-
If necessary, scroll horizontally to the first blank field.
-
Select Click to Add and then select Yes/No from the list.
-
Double-click the new header row, and then type a meaningful name for the new field.
-
Save your changes.
Add to a new table
-
On the Create tab, in the Tables group, click Table.
-
Click Save, and in the Save As dialog box, enter a name for the new table.
-
Select Click to Add and then select Yes/No from the list.
-
Double-click the new header row, and then type a meaningful name for the new field.
-
Save your changes.
Add a Yes/No field in Design view
You can add a Yes/No field to a new or existing table in Design View.
Add to an existing table
-
Open the table in Design View.
-
In the Field Name column, select the first blank row, and then type a name for the field.
-
Select the adjacent cell in the Data Type column, and then select Yes/No from the list.
-
Save your changes.
Add to a new table
-
On the Create tab, in the Tables group, click Table.
-
Click Save, and in the Save As dialog box, enter a name for the new table.
-
Right-click the document tab for the new table and click Design View.
-
In the Field Name column, select the first blank row, and then type a name for the field.
-
Select the adjacent cell in the Data Type column, and then select Yes/No from the list.
-
Save your changes.
Set or change Yes/No field properties
You can use Datasheet View to set a subset of field properties, such as Default Value or Name & Caption, but use Design View to set all available properties, including Format or Indexed.
-
Open the table in Design View.
-
On the General tab in the lower section of the table designer, under Field Properties, locate the property that you want to change.
-
Select the field next to the property name. Depending on the property, you can enter data, start the Expression Builder by clicking , or select an option from a list.
For information about how to use each field property, select the property and then press F1.
Delete a Yes/No field
Important When you delete a Yes/No field that contains data, you lose that data permanently — you cannot undo the deletion. For that reason, you should back up your database before you delete any table fields or other database components.
Delete from Datasheet view
-
Open the table in Datasheet View.
-
Locate the Yes/No field, right-click the header row (the name), and then click Delete Field.
-
Click Yes to confirm the deletion.
Delete from Design view
-
Open the table in Design View.
-
Click the row selector (the blank square) next to the Text field, and then press DELETE, or right-click the row selector and then click Delete Rows.
-
Click Yes to confirm the deletion.
Yes/No field property reference
When you use Design View to add a Yes/No field to a table, you can set and change a number of properties for the field. This table shows the Yes/No field properties, describes what each one does, and explains the implications of setting or changing them.
Property |
Use |
---|---|
Caption |
The label text that is displayed for this field by default in forms, reports, and queries. If this property is empty, the name of the field is used. Any text string is allowed. An effective caption is usually brief. |
Default Value |
Automatically assigns the specified value to this field when a new record is added. |
Format |
Determines the way that the field appears when it is displayed or printed in datasheets, or in forms or reports that are bound to the field. Select one of the following:
|
Indexed |
Specifies whether the field has an index. There are three available values:
Note: Do not change this property for a field that is used in a primary key. Although you can create an index on a single field by setting the Indexed field property, some kinds of indexes cannot be created in this manner. For example, you cannot create a multi-field index by setting this property. |
Text Align |
Specifies the default alignment of text within a control. |
Validation Rule |
Supplies an expression that must be true whenever you add or change the value in this field. Use in conjunction with the Validation Text property. |
Validation Text |
Enter a message to display when a value that is entered violates the expression in the Validation Rule property. |