ACC: "There Is No Control Called..." Requery Control Err Msg

ID: Q92899


The information in this article applies to:


SUMMARY

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

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 kbusage McrArg 
Version           : 1.0 1.1 2.0 7.0 97
Platform          : WINDOWS 
Issue type        : kbinfo 

Last Reviewed: March 12, 1999