CodeProject 物件 (Access)CodeProject object (Access)

CodeProject 物件參照程式碼資料庫中的 Microsoft Access 專案 (.adp) 或 Access 資料庫中專案。The CodeProject object refers to the project for the code database of a Microsoft Access project (.adp) or Access database.


CodeProject物件都有幾個集合包含程式碼資料庫中的特定**AccessObject** 物件。The CodeProject object has several collections that contain specific AccessObject objects within the code database. 下表列出 Access 專案定義的每個集合的名稱,以及其中包含的物件類型。The following table lists the name of each collection defined by Access project and the types of objects it contains.

集合Collections 物件類型Object type
AllFormsAllForms 所有表單All forms
AllReportsAllReports 所有報表All reports
AllMacrosAllMacros 所有巨集All macros
AllModulesAllModules 所有模組All modules


[!注意事項] 上表中的集合包含了資料庫中各方面的物件,不管它們是否開啟還是關閉。The collections in the preceding table contain all of the respective objects in the database regardless if they are opened or closed.

例如,代表在表單的 AccessObject 物件是 AllForms 集合,這是目前資料庫中的 AccessObject 物件的集合的成員。For example, an AccessObject object representing a form is a member of the AllForms collection, which is a collection of AccessObject objects within the current database. AllForms 集合內,將集合中的個別成員編製索引開頭為零。Within the AllForms collection, individual members of the collection are indexed beginning with zero. 您可以參閱下列的方式參照名稱或索引參照它集合內的表單在 AllForms 集合中的個別 AccessObject 物件。You can refer to an individual AccessObject object in the AllForms collection either by referring to the form by name, or by referring to its index within the collection. 如果您想要參照在AllForms集合中的特定物件,最好是因為可能會變更的項目集合索引依名稱參照至它。If you want to refer to a specific object in the AllForms collection, it's better to refer to it by name because an item's collection index may change. 如果物件名中包含空格,那麼必須先將名稱使用中括號 ([ ]) 括起來。If the object name includes a space, the name must be surrounded by brackets ([ ]).

語法Syntax 範例Example
AllForms!formnameAllForms!formname AllForms !訂購表單AllForms!OrderForm
AllForms![form name]AllForms![form name] AllForms![Order Form]AllForms![Order Form]
AllForms("formname")AllForms("formname") AllForms("OrderForm")AllForms("OrderForm")
AllForms(index)AllForms(index) AllForms(0)AllForms(0)



請參閱See also

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.