Microsoft Office 2000/Visual Basic Programmer's Guide |
To read the ownership of an object by using ADOX, you use the GetObjectOwner method of the Catalog object to return a String value that specifies the user or group that owns the object. The syntax for the GetObjectOwner method has the following format:
ReturnValue = GetObjectOwner(ObjectName, ObjectType[, ObjectTypeID])
The ObjectName argument is a Variant value specifying the name of the object to read ownership for. The ObjectType and ObjectTypeID arguments work in the same fashion as the SetPermissions and GetPermissions methods. The ObjectType argument is a Long value specifying the type of object you are reading ownership for. For forms, reports, or macros, the ObjectType argument must be set to adPermObjProviderSpecific and the ObjectTypeID argument must be set to a Variant value that specifies the GUID for the corresponding object. If you want to read ownership for the database itself, set the Name argument to Null, and set the ObjectType argument to adPermObjDatabase. For ObjectType argument constants and form, report, and macro GUIDs for the ObjectTypeID argument, see the tables for the SetPermissions method in "Setting Permissions" earlier in this chapter.
You can view the SetOwnerInAccess and GetOwnerInAccess procedures, which set and read the ownership of objects, in the AccessSecurity.mdb file in the ODETools\V9\Samples\ODETools\V9\Samples\OPG\Samples\CH18 subfolder on the Office 2000 Developer CD-ROM.