全部显示

AllStoredProcedures 集合

         
多个对象
AllStoredProcedures
AccessObject

AllStoredProcedures 集合包含 CurrentDataCodeData 对象中每个存储过程AccessObject 对象。

使用 AllStoredProcedures 集合

CurrentDataCodeData 对象具有一个 AllStoredProcedures 集合,其中包含描述由 CurrentDataCodeData 指定的所有存储过程的实例的 AccessObject 对象。例如,可以在 Visual Basic 中列举 AllStoredProcedures 集合来设置或返回该集合中单个 AccessObject 对象的属性值。

提示   For Each...Next 语句对列举集合非常有用。

可以引用 AllStoredProcedures 集合中的单个 AccessObject 对象,方法是:按照名称引用对象,或引用集合中对象的索引。如果要引用 AllStoredProcedures 集合中特定的对象,最好按照名称引用存储过程,因为存储过程的集合索引可能会更改。

AllStoredProcedures 集合的索引是从零开始的。如果通过索引来引用存储过程,则第一个存储过程是 AllStoredProcedures(0),第二个存储过程是 AllStoredProcedures(1),依此类推。

注意

下面的示例将打印 AllProcedures 集合中每个打开的 AccessObject 对象的名称。

Sub AllStoredProcedures()
    Dim obj As AccessObject, dbs As Object
    Set dbs = Application.CurrentData
    ' Search for open AccessObject objects in
    ' AllStoredProcedures collection.
    For Each obj In dbs.AllStoredProcedures
        If obj.IsLoaded = True Then
            ' Print name of obj.
            Debug.Print obj.Name
        End If
    Next obj
End Sub