ACC2000: Pressing CTRL+ALT+SPACEBAR Enters the Control's Default Value (209801)



The information in this article applies to:

  • Microsoft Access 2000

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.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start Microsoft Access and open the sample database Northwind.mdb.
  2. 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
    					
  3. 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
    					
  4. Save the form as frmTestDefaults and close it.
  5. Open the form in Form view.

    Note that the State field in the first record defaults to WA.
  6. Replace WA with CA in the first record, and then save the record.
  7. 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.

REFERENCES

For more information about the DefaultValue property, click Microsoft Access Help on the Help menu, type defaultvalue property in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Modification Type:MajorLast Reviewed:6/24/2004
Keywords:kbprb kbusage KB209801