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: Filter by Form with Combo Box Does Not Work in an Access Project


View products that this article applies to.

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

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

↑ Back to the top


Symptoms

In an Access project, when you run a filter by form that has a combo box, after you select an item from the combo box and apply the filter, you receive the following error messages:
Cannot apply filter on one or more fields specified in the Filter property.
"Microsoft Access didn't apply the filter. Microsoft Access may not be able to apply the filter if you entered an invalid data type in one of the fields. Do you want to close the filter anyway?"

↑ Back to the top


Cause

The filter is not applying the bound column of the combo box. Access needs the bound column to look up the matching records.

↑ Back to the top


Resolution

Instead of running a filter by form that has a combo box, create a form that emulates query-by-form by implementing custom Visual Basic for Applications code. For additional information about emulating query-by-form, click the article number below to view the article in the Microsoft Knowledge Base:
235359� ACC2000: Implementing Query-by-Form in an Access Project

↑ Back to the top


Status

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

↑ Back to the top


More information

Steps to Reproduce the Behavior

  1. Create a new Access project that is based on the Northwind database from Microsoft SQL Server 2000.
  2. Create a new form that is based on the EmployeeTerritories table.
  3. Add a combo box to the form, and then set the following properties:
       ControlSource:  EmployeeID
       RowSource:  "SELECT EmployeeID, LastName FROM Employees"
       Bound Column:  1
       Column Count:  2
       Column Width:  0";1"
    					
  4. Add TerritoryID to the form.
  5. View the form in Form view.
  6. On the Records menu, point to Filter, and then click Filter by Form.
  7. Note that the entries in the list for EmployeeID are listed with the last names as expected.
  8. Select Dodsworth from the EmployeeID combo box, and then on the Records menu, point to Filter, and click Apply Filter. Note that you receive the following error:
    Cannot apply filter on one or more fields specified in the Filter property.
    When you click OK, you receive another error:
    Microsoft Access didn't apply the filter. Microsoft Access may not be able to apply the filter if you entered an invalid data type in one of the fields. Do you want to close the filter anyway?
    Click Yes to build the filter.
  9. View the form in Design view.
  10. On the View menu, click Properties. In the property sheet for the form, click to the Data tab. Note that the Filter property of the form is set to:
    ((EmployeeID="Dodsworth"))
    You would expect the filter to be set to:
    ((EmployeeID=9))

↑ Back to the top


Keywords: KB264791, kbpending, kbbug, kberrmsg

↑ Back to the top

Article Info
Article ID : 264791
Revision : 2
Created on : 6/28/2004
Published on : 6/28/2004
Exists online : False
Views : 314