Microsoft KB Archive/209801

= ACC2000: Pressing CTRL+ALT+SPACEBAR Enters the Control's Default Value =

Article ID: 209801

Article Last Modified on 6/24/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q209801



Novice: Requires knowledge of the user interface on single-user computers.

This article applies only to a Microsoft Access database (.mdb).



SYMPTOMS
When you create a form based on a table that has one or more fields defined with the DefaultValue property, pressing CTRL+ALT+SPACEBAR inserts the control's default value defined in the form rather than the field's default value defined in the table. If no value has been defined for the control's DefaultValue property, CTRL+ALT+SPACEBAR has no effect.



CAUSE
This behavior occurs because if you set the DefaultValue property for a form control that is bound to a field that also has a DefaultValue property setting defined in the table, the control setting overrides the table setting. When you enter new records in Form view, any control that has a DefaultValue property defined is displayed with the control's default value. If you decide that you want to have the default value that was defined in the table, you have to type it in. You can enter the default value by pressing CTRL+ALT+SPACEBAR.

When you are entering data in the table's Datasheet view, pressing CTRL+ALT+SPACEBAR inserts the field's default value, as defined in the table.



Steps to Reproduce the Behavior
 Start Microsoft Access and open the sample database Northwind.mdb.  Create and save the following new table called TestDefaults: Table: TestDefaults --- Field Name: City Data Type: Text Field Name: State Data Type: Text DefaultValue: NC                     Create a new form in Design view with the following properties: Form: frmTestDefaults --- Record Source: TestDefaults

Text Box: Name: txtCity ControlSource: City Text Box: Name: txtState ControlSource: State DefaultValue: WA                    Save the form as frmTestDefaults and close it. Open the form in Form view.

Note that the State field in the first record defaults to WA.</li> Replace WA with CA in the first record, and then save the record.</li> Delete CA in the State field, and then press CTRL+ALT+SPACEBAR.

Note that the form's default value, WA, appears in the State field.</li></ol>

<div class="references_section">