ACC2002: Unable to Cancel Apply Server Filter in an Access Project (293625)



The information in this article applies to:

  • Microsoft Access 2002

This article was previously published under Q293625
Advanced: Requires expert coding, interoperability, and multiuser skills.

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

SYMPTOMS

When you apply a server filter to a form in an Access project (.adp), setting the Cancel argument of the ApplyFilter event procedure to True does not stop the filter from being applied. Consequently, the form's recordset is filtered.

CAUSE

The Cancel argument of the ApplyFilter event procedure is ignored when you apply a server filter.

STATUS

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

MORE INFORMATION

Setting the Cancel argument to True usually cancels the event and places the database in a state that existed before the event was called. However, the Cancel flag is ignored if the form's ServerFilter property is set to Yes.

Steps to Reproduce the Behavior

  1. Open the sample Access project NorthwindCS.adp.
  2. Open the Products form in Design view.
  3. Set the ServerFilterByForm property of the Products form to Yes.
  4. Set the OnApplyFilter property of the Products form to the following event procedure:
    Sub Form_ApplyFilter(Cancel as Integer, ApplyType as Integer)
    
      Select Case ApplyType
         Case 0
            MsgBox "acShowAllRecords"
         Case 1
            MsgBox "acApplyFilter"
         Case 2
            MsgBox "acCloseFilterWindow"
         Case 3
            MsgBox "acApplyServerFilter"
            Cancel = True
         Case 4
            MsgBox "acCloseServerFilterWindow"
      End Select
    
    End Sub
    					
  5. Open the Products form in Form view.
  6. In the Product Name text box, type Like 'S%'
  7. Click Apply Server Filter on the toolbar.

    A message box appears with the message "acApplyServerFilter," indicating that the event has occurred. Note how the form is still filtered; the form should be back to the server filter in Form view.

Modification Type:MajorLast Reviewed:11/5/2003
Keywords:kbbug KB293625