ACC2000: Bound Combo Box Does Not Display Values
ID: Q223239
|
The information in this article applies to:
Moderate: Requires basic macro, coding, and interoperability skills.
This article applies only to a Microsoft Access project (.adp).
SYMPTOMS
After you upsize a form that has a combo box bound to a Yes/No field in a table, the combo box no longer displays data in a Microsoft Access project. When you try to select a value with the combo box, the value that you specify is saved, but it is not displayed.
CAUSE
When you upsize a database to SQL Server or MSDE, Yes/No fields in your tables are automatically converted to bit columns on SQL Server. If you bind a combo box to a bit column in an Access project, you must display and store Boolean values as True or False, not as -1 or 0.
RESOLUTION
Modify the RowSource property of your combo boxes, replacing -1 with True, and 0 with False.
MORE INFORMATION
The following steps reproduce and correct the behavior described in the "Symptoms" section of this article.
Steps to Reproduce Behavior
- Create a new database named MyTestDatabase.
- Create the following table in the MyTestDatabase database, and then save the table as MyTestTable.
Field Name |
Data Type |
Primary Key? |
MyPK |
Autonumber |
Yes |
MyChar |
Text |
No |
MyYesNo |
YesNo |
No |
- In Design view, add two records to the MyTable table:
MyPK |
MyChar |
MyYesNo |
1 |
First Record |
Yes |
2 |
Second Record |
No |
- Close the table, and create a new form. Base the form on the MyTable table.
- Drag the MyPK and MyChar fields from the field list to the detail section of your new form. (If you cannot see the field list, click Field List on the View menu.)
- If the toolbox is not visible, open it by clicking Toolbox on the View menu.
- Make sure that the Control Wizards are not active (the button in the toolbox does not appear pressed in), and then select a combo box.
- Place the combo box in the detail section of the form.
- Modify the properties of the combo box as follows:
Property Name |
Value |
Control Source |
MyYesNo |
Row Source Type |
Value List |
Row Source |
"True Value";-1;"False Value";0 |
Bound Column |
2 |
- Save the new form as MyForm.
- Open the form in Form view. Note that either "True Value" or "False Value" is displayed in the combo box.
- Close the form.
- Run the Upsizing Wizard by clicking the Tools menu, pointing to Database Utilities, and then clicking Upsizing Wizard.
- Upsize the MyTestDatabase database, choosing to migrate all tables to Create a new client-server application.
- After the upsizing process is complete, examine and close the upsizing report. When you close the report, the new Access project that is created for you by the wizard opens automatically.
- Open the MyForm form in the Access project. Note that no values are displayed in the combo box.
- Open the MyForm form in Design view, and change the Row Source property of the combo box to the following:
"True Value";True;"False Value";False
- Save the form, and then reopen it in Form view. Note that values are now displayed in the combo box.
REFERENCES
For more information about combo boxes, click Microsoft Access Help on the
Help menu, type "combo box" in the Office Assistant or the Answer Wizard,
and then click Search to view the topics returned.
Additional query words:
pra prb
Keywords : kbdta AccessCS
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbprb