ACC2000: Properties Collection Returns Error for CurrentProject and CurrentData Objects (209788)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q209788
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

Advanced: Requires expert coding, interoperability, and multiuser skills.

SYMPTOMS

All object collections under the CurrentProject and CurrentData objects contain a Properties collection. However, when you try to refer to the Properties collection of any object in a collection under the CurrentProject or CurrentData object, you may receive the following error message:
Run-time error '2467':

The expression you entered refers to an object that is closed or doesn't exist.

RESOLUTION

Although you cannot use the Properties collection to refer to properties of these objects, you can refer to the properties directly. For example, use:
Debug.Print CurrentData.AllTables(1).Name
				
instead of:
Debug.Print CurrentData.AllTables(1).Properties("Name")
				

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

NOTE: The syntax used in the following steps only works with the CurrentProject.All<ObjectName> and CodeProject collections.
  1. Open the sample project NorthwindCS.adp.
  2. On the Tools menu, point to Macro, and then click Visual Basic Editor.
  3. On the View menu, click Immediate Window.
  4. In the Immediate Window, type the following code, and then press ENTER:
    ?CurrentData.AllTables(1).Properties.Count
    					
Note that you receive the error message mentioned in the "Symptoms" section of this article.

Modification Type:MinorLast Reviewed:7/15/2004
Keywords:kberrmsg kbprb KB209788