Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: When You Sort Parameter Query Results You Are Prompted for Parameters Again


View products that this article applies to.

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

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

For a Microsoft Access 2002 version of this article, see 287432 (http://support.microsoft.com/kb/287432/EN-US/ ) .

↑ Back to the top


Symptoms

In Access 2000, each time that you sort a query that has parameters, the query prompts you for the parameters again. This behavior does not occur in Access 97.

↑ Back to the top


Resolution

To resolve this problem, obtain Microsoft Office 2000 Service Release 1/1a (SR-1/SR-1a).

To obtain SR-1/SR-1a, click the article number below to view the article in the Microsoft Knowledge Base:
245025� OFF2000: How to Obtain and Install Microsoft Office 2000 Service Release 1/1a (SR-1/SR-1a)
To temporarily work around this problem, create a form to hold the parameters, and then have the query refer to that form. To see how this works, follow these steps:
  1. Open the sample database Northwind.mdb.
  2. In the Database window, click Queries, and then click New.
  3. In the New Query dialog box, click Design, and then click OK.
  4. In the Show Table dialog box, click the Orders table, and then click OK.
  5. Add the following fields to the query design grid:
       Field: OrderID
       Table: Orders
    
       Field: CustomerID
       Table: Orders
    
       Field: OrderDate
       Table: Orders
       Criteria: Is Not Null And Between [Forms]![frmOrdersByDate]![StartDate]
                 And [Forms]![frmOrdersByDate]![EndDate]
  6. On the Query menu, click Parameters.
  7. Type the following parameters, and select the following data types:
    Collapse this tableExpand this table
    ParameterData type
    [Forms]![frmOrdersByDate]![StartDate]Date/Time
    [Forms]![frmOrdersByDate]![EndDate]Date/Time
  8. Save the query as OrdersByDate, and then close it.
  9. Create the following new form:
       Form: frmOrdersByDate
       ---------------------
       Caption: TestForm
    
       Command button
       ---------------------
       Name: Button0
       Caption: Show Records
    
       TextBox
       ---------------
       Name: StartDate
    
       TextBox
       ------------------------------
       Name: EndDate
    
  10. Set the OnClick property of the command button to the following event procedure:
    Private Sub OK_Click()
       DoCmd.OpenQuery "OrdersByDate"
    End Sub
  11. Save the form as frmOrdersByDate, and then open the form in Form view.
  12. For the parameters, enter the following:
       StartDate: 1/1/1997
       EndDate:   12/31/1997
  13. Click the Show Records button. The query results are displayed.
  14. On the Records menu, point to Sort, and then click Sort Ascending.
Note that the data is sorted, and that you are not prompted for the parameters again.

↑ Back to the top


Status

This problem was corrected in Microsoft Office 2000 SR-1/SR-1a.

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Open the sample database Northwind.mdb.
  2. Run the "Sales by Year" query.
  3. For the parameters, enter the following:
       StartDate: 1/1/1997
       EndDate:   12/31/1997
    The query results are displayed.
  4. On the Records menu, point to Sort, and then click Sort Ascending.
Note that you are prompted for the parameters again.

↑ Back to the top


Keywords: KB245467, kbprb, kbdta, kbfix

↑ Back to the top

Article Info
Article ID : 245467
Revision : 1
Created on : 11/25/2002
Published on : 11/25/2002
Exists online : False
Views : 333