ACC: Using Find Command in a Query Causes Error

ID: Q158926


The information in this article applies to:


SYMPTOMS

Moderate: Requires basic macro, coding, and interoperability skills.

When you use the Find dialog box to search for a value in a query, you may receive the following error message.

In Microsoft Access 97

MSACCESS caused a stack fault in module MSJET35.DLL

In Microsoft Access 7.0

MSACCESS caused a stack fault in module MSJT3032.DLL

In Microsoft Access 2.0

MSACCESS caused a General Protection Fault in module MSACCESS.EXE
Note that this error only occurs when you display unique values in your query result, and the field you are searching with Find is sorted in Ascending order.


RESOLUTION

To work around the problem, create a form based on the query and use other methods to search for specific records on your form.

The following example uses the sample database Northwind.mdb (or NWIND.MDB in version 2.0) to demonstrate a method to find a record using a combo box on a form:

  1. Open the sample database Northwind.mdb (or NWIND.MDB in version 2.0).


  2. Create the following new query called EmployeeZip based on the Employees table:


  3. 
          Query: EmployeeZip
          -------------------------------------------------
          Type: Select Query
    
          Field: Region
             Table: Employees
          Field: PostalCode (or Postal Code in version 2.0)
             Table: Employees
             Sort: Ascending 
  4. On the View menu, click Properties. If the Field List Properties dialog box appears, click in an empty space in the upper half of the query design window to view the Query Properties dialog box.


  5. Set the Unique Values property of the query to Yes.


  6. Save the query and close it.


  7. Create the following new macro called FindZip:


  8. 
          Macro Name        Action
          -----------------------------
          FindZip           GoToControl
                            FindRecord
    
          Locate Product Actions
          -------------------------------
          GoToControl
             Control Name: PostalCode
          FindRecord
             Find What: =[FindPostalCode]
             Find First: Yes 
  9. Create the following new form in Design view called FindEmployeeZip:


  10. 
          Form: FindEmployeeZip
          -----------------------------------
          RecordSource: EmployeeZip
          Caption: Find Employee Postal Codes
          DefaultView: Single Form
    
          Text Box
             Name: Region
             ControlSource: Region
          Text Box
             Name: PostalCode
             ControlSource: PostalCode (or Postal Code in version 2.0)
          Combo Box
             Name: FindPostalCode
             RowSource: EmployeeZip
             ColumnCount: 2
             ColumnWidths: 0";1"
             BoundColumn: 2
             AfterUpdate: FindZip 
  11. View the FindEmployeeZip form in Form view. Note that when you select a zip code in the combo box, the record with that zip code becomes the current record on the form.



STATUS

Microsoft has confirmed this to be a problem in Microsoft Access 2.0, 7.0 and 97.


MORE INFORMATION

Steps to Reproduce Problem

WARNING: Following these steps will cause a general protection fault on your computer. Make sure you save and close any open work on your computer before following these steps.
  1. Perform steps 1 through 4 in the "Resolution" section of this article.


  2. View the query in Datasheet view.


  3. Click in the Postal Code column.


  4. On the Edit menu, click Find.


  5. In the Find In Field dialog box, type 98033 in the Find What box, and then click Find First.


  6. Type 98052 in the Find What box, and then click Find Next.


  7. Type 98033 in the Find What box, and then click Find Next.


  8. Click Find Next again. Note that the error occurs.



Keywords          : kberrmsg QryGnrl 
Version           : 2.0 7.0 97
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: May 13, 1999