Microsoft Office 2000/Visual Basic Programmer's Guide   

Setting Ownership

To set the ownership of an object by using ADOX, you use the SetObjectOwner method of the Catalog object to specify the user or group that owns the object. The syntax for the SetObjectOwner method has the following format:

SetObjectOwner(ObjectName, ObjectType, UserName[, ObjectTypeID])

The ObjectName argument is a Variant value specifying the name of the object to set ownership for, and the UserName argument is a String value specifying the name of the user or group you want to own the object. The ObjectType and ObjectTypeID arguments work in the same fashion as those for the SetPermissions and GetPermissions methods. The ObjectType argument is a Long value specifying the type of object you are setting ownership for. For forms, reports, or macros, the ObjectType argument must be set to adPermObjProviderSpecific and the ObjectTypeID argument is set to a Variant value that specifies the GUID for the corresponding object. If you want to set ownership for the database itself, set the ObjectName 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.