Microsoft KB Archive/92899

From BetaArchive Wiki
Knowledge Base


ACC: "There Is No Control Called..." Error Message When You Requery a Control

Article ID: 92899

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 Q92899

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

SUMMARY

When you try to requery a control by using the Requery macro action, you receive an error message indicating that the specified control does not exist even though the control does exist on the form.

MORE INFORMATION

For the Requery Control Name parameter, Microsoft Access expects a short control name without any brackets ([ ]). The Microsoft Access Help system states that you should not use the full syntax, but it does not state that the brackets must be omitted, even if the control name consists of more than one word. Because other scenarios require the use of brackets, this inconsistency may be confusing.

The following example reproduces the behavior and discusses a workaround:

  1. Open the sample database Northwind.mdb (or NWIND.MDB in version 1.x and 2.0).
  2. Open the Products form in Design view. Note that the form has a combo box named SupplierID (or Supplier ID in version 1.x and 2.0).
  3. Add a command button anywhere to the form.
  4. Click the Build button for the command button's OnClick property and click Macro Builder.
  5. Save the macro with the default name suggested by Microsoft Access, and then specify the following Action/Parameter:

          Action       : Requery
          Control Name : [SupplierID]
                            


    Note that [SupplierID] is enclosed in brackets.

  6. Save and minimize the macro.
  7. Switch the form to Form view and click the command button. Note that you receive the following error:

    There is no field called '[SupplierID]' in the current record.
  8. Restore the macro, remove the brackets from [SupplierID] in the Control Name argument, and then save the macro.
  9. Switch the form to Form view and click the command button. Note that the control now works properly.



Additional query words: named

Keywords: kberrmsg kbinfo kbusage KB92899