ACC2000: Text Box Is the Default Control Type When You Drag a Field onto a Data Access Page (202132)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q202132
Novice: Requires knowledge of the user interface on single-user computers.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

SYMPTOMS

When you drag a field onto a data access page, Microsoft Access, by default, creates a text box control for all field types, except for those fields with a data type of Yes/No or Bit.

RESOLUTION

Before you drag the field onto the page, first select the control type that you want to use from the toolbox. For an example of how to do so, follow these steps:
  1. Open the sample database Northwind.mdb.
  2. Create a new data access page that is based on the Employees table.
  3. If the field list is not displayed, click Field List on the View menu.
  4. Click the Dropdown List Control in the toolbox, and then drag the ReportsTo field onto the page. Note that Access now associates this field with a dropdown list control instead of a text box control.

MORE INFORMATION

When you drag a field onto a form or a report in an Access database, Access chooses which control should be created based on the field's data type and the Lookup property assigned to that field. For example, if the field's data type is Text, Access creates a control based on the value assigned to the Lookup property of that field. If the Lookup property is set to Text Box, Access automatically creates a text box on the form. If the Lookup property is set to Combo Box or List Box, Access automatically creates a combo box or list box control, respectively.

With data access pages, Access assigns a text box control to a field that you drag onto a page, regardless of the field's Lookup property, unless the field's data type is Yes/No or Bit. If the field's data type is Yes/No or Bit, Access creates a check box control. A text field that uses the Lookup property of combo box, for example, will still appear as a text box control when you drag the field onto a page.

Steps to Reproduce the Behavior

  1. Open the sample database Northwind.mdb.
  2. Create a new blank form that is based on the Employees table.
  3. Drag EmployeeID, LastName, and ReportsTo from the field list onto the detail section of the form.
  4. Note how the EmployeeID and LastName fields are bound to text box controls, whereas the ReportsTo field is bound to a combo box control. These fields have the following attributes:
    Field NameData TypeLookup
    EmployeeIDAutoNumber(none)
    LastNameTextText Box
    ReportsToNumberCombo Box


  5. Close the form without saving it.
  6. Create a new data access page that is also based on the Employees table.
  7. Drag the same fields listed in step 3 onto Section: Unbound section of the page. Note that all fields are bound to text box controls, even the ReportsTo field, which appeared on the Access form as a combo box control.

Modification Type:MinorLast Reviewed:7/14/2004
Keywords:kbDAP kbprb KB202132