ACC2002: Access Crashes When You Sort a Table That Has a Subdatasheet (295251)



The information in this article applies to:

  • Microsoft Access 2002

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

This article applies only to a Microsoft Access project (.adp).

SYMPTOMS

When you apply a sort to a table, a view, a stored procedure, or a function in a Microsoft Access project (.adp) file, you receive the following error message, and then Microsoft Access crashes.
Microsoft Access has encountered a problem and needs to close. We are sorry for the inconvenience.
When you view the details of the error report, you see that the error occurred in Msaccess.exe.

CAUSE

This behavior occurs when all of the following conditions are true:

  • The object contains a subdatasheet that has been expanded at least once.
  • You used the Sort Ascending or Sort Descending commands on the menu or toolbar to sort the object.
  • The object returns approximately 700 records or more. The actual number of records may vary in different tables.

RESOLUTION

There are several possible workarounds for this problem.

Apply Sorting in Design View of a View, a Stored Procedure, or a Function

One workaround to the problem is to not use the Sort Ascending or Sort Descending commands on the menu or toolbar. Instead, create a view, a stored procedure, or a function, and then apply the sort by using the Sort Type column in the graphical designer. If you are using the text designer to create a function or a stored procedure, add the ORDER BY clause to your SQL statement to apply the sorting.

Restrict the Resultset Returned by the Object

A second workaround is to use criteria in a view, a stored procedure, or a function to restrict the number of records returned by the object. Because the actual number of records may vary in different situations, you have to experiment to find the number of records where the problem occurs, and then restrict the resultset to return fewer records.

Use a Linked Subform Instead of a Subdatasheet

A third workaround is to use a subform instead of a subdatasheet. You can create a main form that is based on the main table or query that contained the subdatasheet and a subform that is based on the table or query being used as the subdatasheet. Then, you can link the subform to the main form by setting the LinkChildFields and LinkMasterFields properties in Design view.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

This problem occurs because of a timing issue that Microsoft Access encounters when the object returns a certain number of records. This timing problem causes Microsoft Access to recursively call an internal function until it crashes. In the Orders table of the NorthwindCS.adp sample project, this problem occurs when the table contains approximately 700 records. However, the actual number of records where this problem occurs may vary in different tables.

Steps to Reproduce the Behavior

WARNING: If you follow these steps, a general protection fault will occur on your computer. Make sure that you save and then close any open work on your computer before you follow these steps.

  1. Open the sample project NorthwindCS.adp.
  2. Open the Orders table in Datasheet view.
  3. On the Edit menu, point to Go To, and then click Last.
  4. Expand the subdatasheet for the last record by clicking the plus sign (+) at the far left of the table.
  5. Click into the OrderID column of the last record in the Orders table. Leave the subdatasheet open.
  6. On the Records menu, point to Sort, and then click Sort Descending.
Note that you receive the error message that is mentioned in the "Symptoms" section of this article.

Modification Type:MajorLast Reviewed:10/20/2003
Keywords:kbbug kberrmsg kbnofix KB295251