| 网站首页 | 新闻 | 新书 | 专家 | 技巧 | 源码作品 | 工具/资源 | 商城 | 风采 | 留言 | 论坛 | 网址 | 承接 | 
您现在的位置: Access/Office中国 >> 技巧 >> Access >> 微软KB >> 文章正文 用户登录 新用户注册
BUG: You may notice an incorrect sorted order when you sort the negative decimal values in descending order in Access         
BUG: You may notice an incorrect sorted order when you sort the negative decimal values in descending order in Access
作者:Microsof… 文章来源:本站原创 点击数: 本日:{$DayHits} 更新时间:2004-3-26 13:38:54

Microsoft Knowledge Base Article - 837148  
BUG: You may notice an incorrect sorted order when you sort the negative decimal values in descending order in access

适用于:


This article applies only to a Microsoft access database (.mdb).

Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
When you sort the records in a Number field in descending order, and the Field Size property of the Number field is set to Decimal, you may notice that the negative values in the field are not sorted in the correct order. This problem occurs in a Microsoft access table.

For example, you can sort a Number field in descending order that contains the following data:

20, -10, 5, -5, 10, -20

After you sort the Number field in descending order, you may notice that the sorted data appears in the following order:

-5, -10, -20, 20, 10, 5

WORKAROUND
To work around this problem, create an index on the Number field before you sort the records in the Number field. To do this, follow these steps:
  1. Start access.
  2. Open your access database.
  3. In the Database window, click Tables under the Objects section.
  4. In the right pane, right-click the table that contains the problem field, and then click Design View.
  5. Select the problem field.
  6. In the Field Properties section, set the value of the Indexed property to Yes (Duplicate OK).
  7. On the File menu, click Save.
  8. On the View menu, click Datasheet View.
  9. Select the problem field.
  10. On the Records menu, point to Sort, and then click Sort Descending.

    Notice that the sorted data appears in the correct order.
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
MORE INFORMATION Steps to reproduce the problem
  1. Start access.
  2. Open the Northwind.mdb sample database.
  3. In the Database window, click Tables under the Objects section.
  4. In the right pane, double-click Create table in Design view.
  5. Create a table that is named TestTbl that has two fields that are named fldID and fldNumber. Set the properties of the fields as follows:

    Table: TestTbl
       ----------------------------
       Field Name : fldID
       Data Type : AutoNumber
    
    
    
       Field Name : fldNumber
       Data Type : Number
       Field Size : Decimal
    
    
       Table Properties: TestTbl
       -------------------------------
       PrimaryKey: fldID
  6. On the File menu, click Save.
  7. In the Save As dialog box, type TestTbl in the Table Name box, and then click OK.
  8. On the View menu, click Datasheet View.
  9. Enter the following data in the fldNumber field:

    20, -10, 5, -5, 10, -20
  10. Select the fldNumber field.
  11. On the Records menu, point to Sort, and then click Sort Descending.

    Notice that the sorted data appears in the incorrect order.
REFERENCES
For more information about indexes in access 2003, click Microsoft Office access Help on the Help menu, type About indexing fields and records in an access database (.mdb) in the Search for box in the Assistance pane, and then click Start searching to view the topic.

For more information about indexes in Access 2002 and access 2000, click Microsoft access Help on the Help menu, type About indexing fields and records in an access database in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

For more information about sorting in access 2003, click Microsoft Office access Help on the Help menu, type About sorting records in the Search for box in the Assistance pane, and then click Start searching to view the topic.

For more information about sorting in Access 2002 and access 2000, click Microsoft access Help on the Help menu, type About sorting records in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
The information in this article applies to:

Last Reviewed: 3/11/2004 (1.0)
Keywords: kbJET kbfield kbProperties kbtable kbbug KB837148 kbAudDeveloper

文章录入:zhuyiwen    责任编辑:zhuyiwen 
  • 上一篇文章:

  • 下一篇文章: 没有了
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    专 题 栏 目
    最 新 热 门
    最 新 推 荐
    相 关 文 章
    没有相关文章
    网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)