| | Product Information Help and How-to Training Templates Support and Feedback Technical Resources Additional Resources | Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.
Set a default value for a field or control (MDB)
Note The information in this topic applies only to a Microsoft Access database (.mdb). In a Microsoft Access database (Microsoft Access database: A collection of data and objects (such as tables, queries, or forms) that is related to a particular topic or purpose. The Microsoft Jet database engine manages the data.), you can define a default value in table Design view (Design view: A window that shows the design of these database objects: tables, queries, forms, reports, macros, and data access pages. In Design view, you can create new database objects and modify the design of existing ones.), and in a Yes/No field, you can set a default value for international use. In a Microsoft Access file (Microsoft Access file: An Access database or Access project file. An Access database stores database objects and data in an .mdb file. A project file doesn't contain data and is used to connect to a Microsoft SQL Server database.), you can define a default value for a control (control: A graphical user interface object, such as a text box, check box, scroll bar, or command button, that lets users control the program. You use controls to display data or choices, perform an action, or make the user interface easier to read.) on a form or data access page in Design view. Set a default value for a field in a table
- Open a table in Design view.
- In the upper portion of the window, click the field you want to define a default value for.
- In the lower portion of the window, click the DefaultValue property box, and then type a default value such as New York, or an expression (expression: Any combination of mathematical or logical operators, constants, functions, and names of fields, controls, and properties that evaluates to a single value. Expressions can perform calculations, manipulate characters, or test data.) such as Date().
Note Setting the DefaultValue property for a field has no effect on existing data.
Set the default value of a Yes/No field so that it is displayed in the local language
- Open a table in Design view.
- In the upper portion of the window, click the field you want to define a default value for.
- In the lower portion of the window, click the Lookup tab and set the DisplayControl property for the field to Text Box or Combo Box.
- On the General tab, click the DefaultValue property box and type =Yes or =No.
Set a default value for a control on a form or data access page
- Open a form or data access page in Design view (Design view: A window that shows the design of these database objects: tables, queries, forms, reports, macros, and data access pages. In Design view, you can create new database objects and modify the design of existing ones.).
- Make sure the control (control: A graphical user interface object, such as a text box, check box, scroll bar, or command button, that lets users control the program. You use controls to display data or choices, perform an action, or make the user interface easier to read.) is selected, and then click Properties
on the toolbar to open the control's property sheet.
- Click the Data tab, and in the DefaultValue property box, type the default value (such as New York) or an expression (expression: Any combination of mathematical or logical operators, constants, functions, and names of fields, controls, and properties that evaluates to a single value. Expressions can perform calculations, manipulate characters, or test data.) (such as =Date()). If the string expression that you type includes commas or other punctuation, be sure to enclose the value in quotation marks. For example, to use "New York, NY" as the default value, type "New York, NY". In a form in a Microsoft Access database (Microsoft Access database: A collection of data and objects (such as tables, queries, or forms) that is related to a particular topic or purpose. The Microsoft Jet database engine manages the data.), if you need help creating an expression, click the Build button
to use the Expression Builder (Expression Builder: An Access tool that you can use to create an expression. It includes a list of common expressions that you can select.).
Note If you set the DefaultValue property for a field in table Design view and also set the DefaultValue property for a control bound to that field, the default value set for the control overrides the default value set for the field.
|