ACC2000: Option Buttons on a Data Access Page Must Have Name and ID Property Values (204204)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q204204
Moderate: Requires basic macro, coding, and interoperability skills.

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

SYMPTOMS

When you add an option button to a data access page as a stand-alone control, you are not able to select the button by default. For an option button to work correctly, you must set a value for both the ID and Name properties. When you create an option button from the toolbox in the Design view of a page, the Name property is not automatically set. You must modify the HTML source that defines the option button to include a Name attribute. After you have done so, the option button will become selectable.

RESOLUTION

For an example of how to modify the HTML source for an option button, follow these steps:
  1. In the Database window, click Pages under Objects, and then click New.
  2. In the New Data Access Page dialog box, click Design View, and then click OK.
  3. If the toolbox is not displayed, click Toolbox on the View menu.
  4. Add a new option button to the page.
  5. On the Tools menu, point to Macro, and then click Microsoft Script Editor.
  6. On the View menu, point to Other Windows, and then click Document Outline.
  7. Browse through the Document Outline window to the Option0 control, and then select the control.

    Note that the Script pane contains code similar to the following HTML that defines the Option0 control:
    <INPUT
    id=Option0 style="HEIGHT: 0.166in; LEFT: 1.375in; POSITION: absolute; TOP:
    1.166in; WIDTH: 0.18in" tabIndex=1 title=Option0 type=radio>
    					
  8. Modify the HTML by adding a name attribute. For example, to the code from the previous step, note how a name attribute (name=Option0) is added:
    <INPUT 
    id=Option0 name=Option0 style="HEIGHT: 0.166in; LEFT: 1.375in; POSITION:
    absolute; TOP: 1.166in; WIDTH: 0.18in" tabIndex=1 title=Option0 type=radio>
    					
  9. On the File menu, click Save.
  10. On the File menu, click Close to close the Microsoft Script Editor.
  11. On the View menu, click Page View. Note that the option button on the page is now selectable.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. In the Database window, click Pages under Objects, and then click New.
  2. In the New Data Access Page dialog box, click Design View, and then click OK.
  3. If the toolbox is not displayed, click Toolbox on the View menu.
  4. Add a new option button to the page.
  5. On the View menu, click Page View.

    Note that when you try to select the option button, nothing happens.

Modification Type:MajorLast Reviewed:6/29/2004
Keywords:kbDAP kbpending kbprb KB204204