Microsoft KB Archive/171178
Article ID: 171178
Article Last Modified on 1/20/2007
- Microsoft Access 97 Standard Edition
- Microsoft SQL Server 6.0 Standard Edition
- Microsoft SQL Server 6.5 Standard Edition
This article was previously published under Q171178
Moderate: Requires basic macro, coding, and interoperability skills.
Records from a linked SQL Server table are sorted incorrectly in Microsoft Access datasheets and forms if the following conditions are true:
- A Microsoft Access user opens a long-running query or a form based on a long-running query.
- The query returns records ordered by one or more columns.
- The Microsoft Access user and/or other users delete records to which the query conditions apply.
- The records are deleted before the keyset of the query is completely built (the total number of records in the keyset is not yet displayed at the bottom of the query window).
This behavior is caused by a timing issue between SQL Server and Microsoft Access.
Although some of the records will appear out of sort order in the keyset, they are sorted correctly on the server.
The following procedure requires that you to have access to a SQL Server database containing over 100,000 records.
Steps to Reproduce Behavior
- Open a new database in Microsoft Access 97.
- Link to a SQL Server table that contains at least 100,000 records.
- Create a query based on the linked table and apply criteria that will reduce the recordset to approximately 25,000 records. Set the sort to Ascending for four of the columns in the query.
- Run the query.
NOTE: It is important that the query runs for a long time before all the records are returned.
- While the query is still processing records, use the record number at the bottom of the query window to jump to record number 8040.
NOTE: At this point the complete number of records being returned is not yet displayed. Background processing is still fetching records.
- Start deleting records, a few at a time.
- Scroll down a few times (usually 6 or 7 times) using the scroll bar of the query datasheet window.
Within the records you will notice that some of the records are now out of order.
Keywords: kbinterop kbprb KB171178