ACC2002: Report Auto List Members Shows Generic Control Object List (304524)



The information in this article applies to:

  • Microsoft Access 2002

This article was previously published under Q304524
For a Microsoft Access 2000 version of this article, see 208777.

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

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

SYMPTOMS

The Auto List Members feature in Microsoft Access helps you type Visual Basic for Applications code by displaying a list of the properties and methods of an object as you type.

However, when you type the name of a report control in the class module of a report, the Auto List Members box displays a generic list of methods and properties instead of those specific to that type of control. When you type the name of a form control in the class module of a form, the Auto List Members box displays a specific list of methods and properties for that type of control.

CAUSE

Report controls display a generic list of methods and properties because they do not support the same methods and properties as their counterparts on a form. For example, you cannot use the standard methods of a text box, a label, or an object frame control in a report the same way that you can on a form because a report control does not trigger events.

RESOLUTION

If you want to see a specific list of methods and properties for a control on a report, you must explicitly declare the control object. For example, if your report has a text box control named Text0, the following line of code displays a generic list of methods and properties in the Auto List Members box:
Me!Text0.
				
However, if you dimension a variable of type TextBox as in the following example, you see a specific list of text box methods and properties in the Auto List Members box on the report:
Dim x as TextBox
Set x = Me!Text0
x.
				

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start Access.
  2. On the Help menu, point to Sample Databases, and then click Northwind Sample Database.
  3. On the Tools menu, point to Macro, and then click Visual Basic Editor.
  4. In the Visual Basic Editor, click Options on the Tools menu.
  5. On the Editor tab, click Auto List Members if it is not already selected.
  6. Click OK in the Options dialog box.
  7. Close the Visual Basic Editor window.
  8. Open the Employees form in Design view.
  9. On the View menu, click Code.
  10. Type the following part of a procedure:
    Sub AutoMem()
    Me!EmployeeId.
    						
    Note that when you type the period (.) after EmployeeId, the Auto List Members box displays the methods and properties of a text box control object. The list has AddColon, AfterUpdate, AllowAutoCorrect, and many others.
  11. Close the Employees form without saving it.
  12. Open the Catalog report in Design view.
  13. On the View menu, click Code.
  14. Type the following part of a procedure:
    Sub AutoMem()
    Me!CategoryName.
    						
    Note that when you type the period after CategoryName, the Auto List Members box displays a generic list of methods and properties for a control object.
  15. Retype the code in step 13 so that it looks as follows:
    Sub AutoMem()
    Dim x as TextBox
    Set x = Me!CategoryName
    x.
    						
    Note that when you type the period after the x, the Auto List Members box displays the same list of methods and properties that you see in step 9.
  16. Close the Catalog report without saving it.

REFERENCES

For more information about Auto List Members, click Microsoft Access Help on the Help menu, type auto list members in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

Modification Type:MajorLast Reviewed:9/27/2003
Keywords:kbprb KB304524