ACC2000: Option Group Based on Yes/No or Bit Field on Data Access Page Is Not Displayed Correctly (257696)
The information in this article applies to:
This article was previously published under Q257696 Advanced: Requires expert coding, interoperability, and multiuser skills.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).
SYMPTOMS
When you create an option group on a data access page, and you bind the option group to a Yes/No or to a Bit field, the option buttons in that group do not display any values even though the option group is correctly bound to the page source. However, if you click either the Yes or the No option button in that option group, the underlying value in the table is changed to the value that you selected in the option group.
RESOLUTION
To work around this behavior, follow these steps:
- Open the sample database Northwind.mdb.
- In the Database window, click Pages under Objects, and then click New.
- In the New Data Access Page dialog box, click Design View.
- If the field list is not displayed, click Field List on the View menu.
- Drag the following fields from the Products table from the field list to the 2-D design section of the page:
- ProductID
- ProductName
- Discontinued
- Click the Option Group button in the toolbox, and then drag the button to the design section of the page.
- Change the following properties of the option group:
ID: MyOptionGroup
- Add two option buttons inside the option group frame.
- Change the properties of the first option button as follows:
ID: MyYesOption
Value: -1
- Change the properties of the second option button as follows:
ID: MyNoOption
Value: 0
- On the Tools menu, point to Macro, and then click Microsoft Script Editor.
- By default, there are three panes presented in the Microsoft Script Editor. In the pane on the left, click the Scripts tab.
- Browse through the editor to the following event:
Client Objects and Events\MSODSC\Current
- Place the following between the Script tags:
Document.All.Item("MyYesOption").Checked=False
Document.All.Item("MyNoOption").Checked=False
If MSODSC.DefaultRecordset.Fields.Item("Discontinued") = False Then
Document.All.Item("MyNoOption").Checked = True
Document.All.Item("MyYesOption").Checked = False
Else
Document.All.Item("MyYesOption").Checked = True
Document.All.Item("MyNoOption").Checked = False
End If
- Change the initial Script tag from:
<SCRIPT event=Current for=MSODSC language=vbscript>
to
<SCRIPT event=Current(abc) for=MSODSC language=vbscript>
- Browse through the editor to the following event:
Client Objects and Events\MyYesOption\onclick
- Place the following between the Script tags:
MSODSC.DefaultRecordset.Fields("Discontinued") = -1
Document.All.Item("MyYesOption").Checked = True
Document.All.Item("MyNoOption").Checked = False
- Browse through the Script Editor to the following event:
Client Objects and Events\MyNoOption\onclick
- Place the following between the Script tags:
MSODSC.DefaultRecordset.Fields("Discontinued") = 0
Document.All.Item("MyYesOption").Checked = False
Document.All.Item("MyNoOption").Checked = True
- On the File menu, click Save.
- On the File menu, click Exit to exit the Microsoft Script Editor.
- On the View menu, click Page View. Note that the option group based on the Yes/No field now works as expected.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 6/24/2004 |
---|
Keywords: | kbbug kbDAP kbDAPScript KB257696 |
---|
|