Microsoft KB Archive/101673

From BetaArchive Wiki

Article ID: 101673

Article Last Modified on 1/18/2007



APPLIES TO

  • Microsoft Access 1.0 Standard Edition
  • Microsoft Access 1.1 Standard Edition
  • Microsoft Access 2.0 Standard Edition
  • Microsoft Access 95 Standard Edition
  • Microsoft Access 97 Standard Edition



This article was previously published under Q101673

Novice: Requires knowledge of the user interface on single-user computers.


SYMPTOMS

When you try to run macro actions that contain a Where clause (ApplyFilter, OpenForm, OpenReport, and FindRecord), and queries that reference the Column property of a combo box or list box on a form, you may receive the following error message:

Undefined Function '[Forms]![Formname]![Controlname].column' in Expression.

CAUSE

Microsoft Access interprets any text followed by opening and closing parentheses as a user-defined function.

RESOLUTION

If you wrap the expression inside the Eval() function as a text string, Microsoft Access will consider the entire reference as a whole, and will not try to parse it. For example:

   Eval("[Forms]![Formname]![Controlname].column(2)")
                

STATUS

Microsoft has confirmed this to be a problem in the versions of Microsoft Access listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Problem


  1. Open the sample database Northwind.mdb (or NWIND.MDB in version 2.0 or earlier), and create a new form based on the Orders table.
  2. Add a combo box control with the following properties:

          Form: PromptForm
          --------------------
          RecordSource: Orders
    
          Combo box:
             Name: TheCombo
             RowSource: Orders
             ColumnCount: 4
             BoundColumn: 1
                            
  3. Save the form as PromptForm, and then close it.
  4. Create the following query based on the Employees table:

          Query: ReferenceCombo
          ---------------------
          Type: Select Query
    
          Field: EmployeeID ([Employee ID] in Microsoft Access 1.x and 2.0)
             Table: Employees
             Criteria: =[Forms]![PromptForm]![TheCombo].column(2)
          Field: LastName ([Last Name] in Microsoft Access 1.x and 2.0)
             Table: Employees
          Field: FirstName ([First Name] in Microsoft Access 1.x and 2.0)
             Table: Employees
                            
  5. Open the PromptForm form in Form view and select an item from the combo box.
  6. Open the ReferenceCombo query in Datasheet view. Note that you receive the following error message: Undefined Function '[Forms]![PromptForm]![TheCombo].column' in Expression.


REFERENCES

For more information about using the Column property in an expression, search on "Column property," and then "Refer to a column in a list in an expression," using the Microsoft Access 97 Help Index.

Keywords: kbbug kberrmsg KB101673